fix tests

This commit is contained in:
Friedel Ziegelmayer 2016-11-09 11:05:13 +01:00
parent b7650194a9
commit ddb43af01a
4 changed files with 9 additions and 9 deletions

View File

@ -43,11 +43,12 @@ const secio = require('libp2p-secio')
The current `secio` tag, usable in `multistream`.
### `encrypt(id, key, insecure)`
### `encrypt(id, key, insecure[, callback])`
- `id: PeerId` - The id of the node.
- `key: RSAPrivateKey` - The private key of the node.
- `insecure: PullStream` - The insecure connection.
- `callback: Function` - Called if an error happens during the initialization.
Returns the `insecure` connection provided, wrapped with secio. This is a pull-stream.

View File

@ -46,7 +46,7 @@ suite.add('createKey', function (d) {
pull(
pull.infinite(),
pull.take(100),
pull.map((val) => Buffer(val.toString())),
pull.map((val) => new Buffer(val.toString())),
local
)

View File

@ -23,7 +23,10 @@ module.exports = {
if (!callback) {
callback = (err) => {
throw err
if (err) {
console.error(err)
throw err
}
}
}

View File

@ -32,12 +32,8 @@ describe('secio browser <-> nodejs', () => {
})
})
it('encrypt', (done) => {
secio.encrypt(pid, pid._privKey, conn, (err, c) => {
expect(err).to.not.exist
encryptedConn = c
done()
})
it('encrypt', () => {
secio.encrypt(pid, pid._privKey, conn)
})
it('echo', (done) => {