mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-18 03:31:22 +00:00
fix: dial protocol should throw if no protocol is provided (#914)
BREAKING CHANGE: dialProtocol does not return connection when no protocols are provided
This commit is contained in:
@ -352,6 +352,25 @@ describe('Dialing (direct, TCP)', () => {
|
||||
await pWaitFor(() => remoteConn.streams.length === 0)
|
||||
})
|
||||
|
||||
it('should throw when using dialProtocol with no protocols', async () => {
|
||||
libp2p = new Libp2p({
|
||||
peerId,
|
||||
modules: {
|
||||
transport: [Transport],
|
||||
streamMuxer: [Muxer],
|
||||
connEncryption: [Crypto]
|
||||
}
|
||||
})
|
||||
|
||||
await expect(libp2p.dialProtocol(remotePeerId))
|
||||
.to.eventually.be.rejectedWith(Error)
|
||||
.and.to.have.property('code', ErrorCodes.ERR_INVALID_PROTOCOLS_FOR_STREAM)
|
||||
|
||||
await expect(libp2p.dialProtocol(remotePeerId, []))
|
||||
.to.eventually.be.rejectedWith(Error)
|
||||
.and.to.have.property('code', ErrorCodes.ERR_INVALID_PROTOCOLS_FOR_STREAM)
|
||||
})
|
||||
|
||||
it('should be able to use hangup to close connections', async () => {
|
||||
libp2p = new Libp2p({
|
||||
peerId,
|
||||
|
Reference in New Issue
Block a user