docs: update discovery tests usage (#61)

This commit is contained in:
Vasco Santos 2020-08-17 18:10:55 +02:00 committed by GitHub
parent a60ae091e5
commit d6376377d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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