mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-24 17:52:21 +00:00
docs: update discovery tests usage (#61)
This commit is contained in:
parent
a60ae091e5
commit
d6376377d3
@ -33,19 +33,19 @@ Include this badge in your readme if you make a new module that uses interface-p
|
|||||||
Install `interface-discovery` as one of the dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do:
|
Install `interface-discovery` as one of the dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const test = require('interface-discovery')
|
const tests = require('libp2p-interfaces/src/peer-discovery/tests')
|
||||||
|
|
||||||
const common = {
|
describe('your discovery', () => {
|
||||||
setup () {
|
// use all of the test suits
|
||||||
return YourDiscovery
|
tests({
|
||||||
},
|
setup () {
|
||||||
teardown () {
|
return YourDiscovery
|
||||||
// Clean up any resources created by setup()
|
},
|
||||||
}
|
teardown () {
|
||||||
}
|
// Clean up any resources created by setup()
|
||||||
|
}
|
||||||
// use all of the test suits
|
})
|
||||||
test(common)
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
Loading…
x
Reference in New Issue
Block a user