diff --git a/package.json b/package.json index 976f64fecb..7b8326192b 100644 --- a/package.json +++ b/package.json @@ -38,14 +38,14 @@ }, "dependencies": { "async": "^2.6.1", - "joi": "^13.4.0", + "joi": "^13.6.0", "joi-browser": "^13.4.0", "libp2p-connection-manager": "~0.0.2", "libp2p-floodsub": "~0.15.0", "libp2p-ping": "~0.8.0", - "libp2p-switch": "~0.40.7", + "libp2p-switch": "~0.40.8", "libp2p-websockets": "~0.12.0", - "mafmt": "^6.0.0", + "mafmt": "^6.0.2", "multiaddr": "^5.0.0", "peer-book": "~0.8.0", "peer-id": "~0.11.0", @@ -53,29 +53,29 @@ }, "devDependencies": { "@nodeutils/defaults-deep": "^1.1.0", - "aegir": "^15.1.0", + "aegir": "^15.2.0", "chai": "^4.1.2", "cids": "~0.5.3", "dirty-chai": "^2.0.1", "electron-webrtc": "~0.3.0", - "libp2p-circuit": "~0.2.0", + "libp2p-circuit": "~0.2.1", "libp2p-kad-dht": "~0.10.3", "libp2p-mdns": "~0.12.0", "libp2p-mplex": "~0.8.0", "libp2p-railing": "~0.9.2", "libp2p-secio": "~0.10.0", "libp2p-spdy": "~0.12.1", - "libp2p-tcp": "~0.12.0", - "libp2p-webrtc-star": "~0.15.3", + "libp2p-tcp": "~0.13.0", + "libp2p-webrtc-star": "~0.15.5", "libp2p-websocket-star": "~0.8.1", "libp2p-websocket-star-rendezvous": "~0.2.3", "lodash.times": "^4.3.2", "pull-goodbye": "0.0.2", "pull-serializer": "~0.3.2", - "pull-stream": "^3.6.8", - "sinon": "^6.1.4", + "pull-stream": "^3.6.9", + "sinon": "^6.3.4", "webrtcsupport": "^2.2.0", - "wrtc": "~0.1.6" + "wrtc": "~0.2.0" }, "contributors": [ "Alan Shaw ", diff --git a/test/transports.browser.js b/test/transports.browser.js index bf8db2b721..fcf749b653 100644 --- a/test/transports.browser.js +++ b/test/transports.browser.js @@ -168,7 +168,9 @@ describe('transports', () => { }) }) - it('many writes', (done) => { + it('many writes', function (done) { + this.timeout(10000) + nodeA.dialProtocol(peerB, '/echo/1.0.0', (err, conn) => { expect(err).to.not.exist() @@ -198,6 +200,15 @@ describe('transports', () => { let peer2 let node1 let node2 + let node3 + + after((done) => { + parallel([ + (cb) => node1.stop(cb), + (cb) => node2.stop(cb), + (cb) => node3.stop(cb) + ], done) + }) it('create two peerInfo with webrtc-star addrs', (done) => { parallel([ @@ -270,30 +281,27 @@ describe('transports', () => { }) }) - it('create a third node and check that discovery works', function (done) { - this.timeout(60 * 1000) + it('create a third node and check that discovery works', (done) => { + PeerId.create({ bits: 512 }, (err, id3) => { + expect(err).to.not.exist() - let counter = 0 + const b58Id = id3.toB58String() - function check () { - if (++counter === 3) { - expect(Object.keys(node1._switch.muxedConns).length).to.equal(1) - expect(Object.keys(node2._switch.muxedConns).length).to.equal(1) - done() + function check () { + // Verify both nodes are connected to node 3 + if (node1._switch.muxedConns[b58Id] && node2._switch.muxedConns[b58Id]) { + done() + } } - } - - PeerId.create({ bits: 512 }, (err, id3) => { - expect(err).to.not.exist() const peer3 = new PeerInfo(id3) - const ma3 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/ipfs/' + id3.toB58String() + const ma3 = '/ip4/127.0.0.1/tcp/15555/ws/p2p-webrtc-star/ipfs/' + b58Id peer3.multiaddrs.add(ma3) node1.on('peer:discovery', (peerInfo) => node1.dial(peerInfo, check)) node2.on('peer:discovery', (peerInfo) => node2.dial(peerInfo, check)) - const node3 = new Node({ + node3 = new Node({ peerInfo: peer3 }) node3.start(check)