mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-29 17:01:37 +00:00
Fix swarm.closeConns
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
var Lab = require('lab')
|
||||
var Code = require('code')
|
||||
var sinon = require('sinon')
|
||||
var lab = exports.lab = Lab.script()
|
||||
|
||||
var experiment = lab.experiment
|
||||
@ -85,6 +86,19 @@ experiment('BASICS', function () {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
experiment('Swarm.closeConns', function () {
|
||||
test('calls end on all connections', function (done) {
|
||||
swarmA.openConnection(peerB, function () {
|
||||
var key = Object.keys(swarmA.connections)[0]
|
||||
sinon.spy(swarmA.connections[key].conn, 'end')
|
||||
swarmA.closeConns(function () {
|
||||
expect(swarmA.connections[key].conn.end.called).to.be.equal(true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
experiment('BASE', function () {
|
||||
|
Reference in New Issue
Block a user