mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-29 17:01:37 +00:00
for indutny
This commit is contained in:
@ -23,24 +23,34 @@ beforeEach(function (done) {
|
||||
swarmB = new Swarm()
|
||||
var c = new Counter(2, done)
|
||||
|
||||
swarmA.listen(4000, function () {
|
||||
swarmA.listen(8100, function () {
|
||||
peerA = new Peer(Id.create(), [multiaddr('/ip4/127.0.0.1/tcp/' + swarmA.port)])
|
||||
c.hit()
|
||||
})
|
||||
|
||||
swarmB.listen(4001, function () {
|
||||
swarmB.listen(8101, function () {
|
||||
peerB = new Peer(Id.create(), [multiaddr('/ip4/127.0.0.1/tcp/' + swarmB.port)])
|
||||
c.hit()
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(function (done) {
|
||||
var c = new Counter(2, done)
|
||||
swarmA.close(function () {
|
||||
afterEach({ timeout: 5000 }, function (done) {
|
||||
var c = new Counter(4, done)
|
||||
swarmA.closeConns(function () {
|
||||
c.hit()
|
||||
swarmA.closeListener(function () {
|
||||
console.log('AAA CLOSE')
|
||||
c.hit()
|
||||
})
|
||||
})
|
||||
swarmB.close(function () {
|
||||
|
||||
swarmB.closeConns(function () {
|
||||
console.log('bb')
|
||||
c.hit()
|
||||
swarmB.closeListener(function () {
|
||||
console.log('BBB CLOSE')
|
||||
c.hit()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -58,6 +68,20 @@ experiment('BASE', function () {
|
||||
c.hit()
|
||||
})
|
||||
})
|
||||
|
||||
test('Reuse stream (from dialer)', {timeout: false}, function (done) {
|
||||
var protocol = '/sparkles/3.3.3'
|
||||
var c = new Counter(2, done)
|
||||
|
||||
swarmB.registerHandle(protocol, function (stream) {
|
||||
c.hit()
|
||||
})
|
||||
|
||||
swarmA.openStream(peerB, protocol, function (err, stream) {
|
||||
expect(err).to.not.be.instanceof(Error)
|
||||
c.hit()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
experiment('IDENTIFY', function () {})
|
||||
|
Reference in New Issue
Block a user