fix: dial self (#826)

This commit is contained in:
Vasco Santos
2020-12-09 16:13:25 +01:00
committed by GitHub
parent 8e3bb09279
commit 6350a187c7
4 changed files with 39 additions and 5 deletions

View File

@ -409,5 +409,20 @@ describe('Dialing (direct, WebSockets)', () => {
expect(libp2p.dialer.destroy).to.have.property('callCount', 1)
})
it('should fail to dial self', async () => {
libp2p = new Libp2p({
peerId,
modules: {
transport: [Transport],
streamMuxer: [Muxer],
connEncryption: [Crypto]
}
})
await expect(libp2p.dial(peerId))
.to.eventually.be.rejected()
.and.to.have.property('code', ErrorCodes.ERR_DIALED_SELF)
})
})
})