This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add tests for peer-discovery interface
- Loading branch information
1 parent
3ba8b9e
commit adf6788
Showing
2 changed files
with
23 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} | ||
}) | ||
}) |