fix: clean up peer discovery flow (#494)

* fix: clean up peer discovery flow

* test(fix): let libp2p start after connecting

* test(fix): dont auto dial in disco tests
This commit is contained in:
Jacob Heun
2019-12-03 20:14:15 +01:00
parent 9a6e07d70b
commit 12fc069873
8 changed files with 71 additions and 66 deletions

View File

@ -216,7 +216,8 @@ describe('Dialing (direct, WebSockets)', () => {
})
sinon.spy(libp2p.dialer.identifyService, 'identify')
sinon.spy(libp2p.peerStore, 'update')
sinon.spy(libp2p.peerStore, 'replace')
sinon.spy(libp2p.upgrader, 'onConnection')
const connection = await libp2p.dialer.connectToMultiaddr(remoteAddr)
expect(connection).to.exist()
@ -225,7 +226,7 @@ describe('Dialing (direct, WebSockets)', () => {
expect(libp2p.dialer.identifyService.identify.callCount).to.equal(1)
await libp2p.dialer.identifyService.identify.firstCall.returnValue
expect(libp2p.peerStore.update.callCount).to.equal(1)
expect(libp2p.peerStore.replace.callCount).to.equal(1)
})
it('should be able to use hangup to close connections', async () => {