Skip to content

Commit

Permalink
fix assertion after test end error
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaclennan committed Oct 20, 2023
1 parent 73b12e4 commit 6661e2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/discovery/mdns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { randomBytes } from 'node:crypto'
import net from 'node:net'
import { KeyManager } from '@mapeo/crypto'
import { setTimeout as delay } from 'node:timers/promises'
import pDefer from 'p-defer'
import { keyToPublicId } from '@mapeo/crypto'
import { ERR_DUPLICATE, MdnsDiscovery } from '../../src/discovery/mdns.js'
import NoiseSecretStream from '@hyperswarm/secret-stream'
Expand All @@ -11,7 +12,7 @@ import NoiseSecretStream from '@hyperswarm/secret-stream'
const MDNS_WAIT_TIME = 10000

test('mdns - discovery and sharing of data', (t) => {
t.plan(2)
const deferred = pDefer()
const identityKeypair1 = new KeyManager(randomBytes(16)).getIdentityKeypair()
const identityKeypair2 = new KeyManager(randomBytes(16)).getIdentityKeypair()

Expand Down Expand Up @@ -53,12 +54,15 @@ test('mdns - discovery and sharing of data', (t) => {
mdnsDiscovery2.stop({ force: true }),
]).then(() => {
t.pass('teardown complete')
deferred.resolve()
})
})
})

mdnsDiscovery1.start()
mdnsDiscovery2.start()

return deferred.promise
})

test('deduplicate incoming connections', async (t) => {
Expand Down

0 comments on commit 6661e2c

Please sign in to comment.