Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
chore: discovery should not use once (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored and jacobheun committed Jun 5, 2020
1 parent 66e19e5 commit 9f9853d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/peer-discovery/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = (common) => {
const defer = pDefer()
await discovery.start()

discovery.once('peer', ({ id, multiaddrs }) => {
discovery.on('peer', ({ id, multiaddrs }) => {
expect(id).to.exist()
expect(PeerId.isPeerId(id)).to.eql(true)
expect(multiaddrs).to.exist()
Expand All @@ -63,7 +63,7 @@ module.exports = (common) => {
})

it('should not receive a peer event before start', async () => {
discovery.once('peer', () => {
discovery.on('peer', () => {
throw new Error('should not receive a peer event before start')
})

Expand All @@ -75,14 +75,14 @@ module.exports = (common) => {

await discovery.start()

discovery.once('peer', () => {
discovery.on('peer', () => {
deferStart.resolve()
})

await deferStart.promise
await discovery.stop()

discovery.once('peer', () => {
discovery.on('peer', () => {
throw new Error('should not receive a peer event after stop')
})

Expand Down

0 comments on commit 9f9853d

Please sign in to comment.