mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-12 16:51:23 +00:00
test: update tests to new API
This commit is contained in:
21
test/utils/try-echo.js
Normal file
21
test/utils/try-echo.js
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict'
|
||||
|
||||
const pull = require('pull-stream')
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
|
||||
module.exports = (conn, callback) => {
|
||||
const values = [Buffer.from('echo')]
|
||||
|
||||
pull(
|
||||
pull.values(values),
|
||||
conn,
|
||||
pull.collect((err, _values) => {
|
||||
expect(err).to.not.exist()
|
||||
expect(_values).to.eql(values)
|
||||
callback()
|
||||
})
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user