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

Commit

Permalink
chore: add tests for peer-discovery interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Apr 7, 2020
1 parent 3ba8b9e commit adf6788
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"chai": "^4.2.0",
"delay": "^4.3.0",
"dirty-chai": "^2.0.1",
"interface-discovery": "^0.1.1",
"libp2p-interfaces": "libp2p/js-interfaces#feat/peer-discovery-not-using-peer-info",
"p-defer": "^3.0.0"
},
"dependencies": {
Expand Down
38 changes: 22 additions & 16 deletions test/compliance.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
'use strict'

const test = require('interface-discovery')
/* eslint-env mocha */

const tests = require('libp2p-interfaces/src/peer-discovery/tests')

const PeerId = require('peer-id')
const MulticastDNS = require('../src')
let mdns

const common = {
async setup () {
const peerId = await PeerId.create()
mdns = new MulticastDNS({
peerId: peerId,
broadcast: false,
port: 50001,
compat: true
})

return mdns
}
}
describe('compliance tests', () => {
tests({
async setup () {
const peerId = await PeerId.create()
mdns = new MulticastDNS({
peerId: peerId,
broadcast: false,
port: 50001,
compat: true
})

// use all of the test suits
test(common)
return mdns
},
async teardown () {
// clearInterval(intervalId)
await new Promise(resolve => setTimeout(resolve, 10))
}
})
})

0 comments on commit adf6788

Please sign in to comment.