mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-31 00:12:00 +00:00
chore: update docs
fix: protect against duplicate token releases
This commit is contained in:
@@ -68,6 +68,16 @@ describe('Dialing (direct, WebSockets)', () => {
|
||||
expect(tokens.length).to.equal(0)
|
||||
})
|
||||
|
||||
it('should NOT be able to return a token twice', () => {
|
||||
const dialer = new Dialer({ transportManager: localTM })
|
||||
const tokens = dialer.getTokens(1)
|
||||
expect(tokens).to.have.length(1)
|
||||
expect(dialer.tokens).to.have.length(Constants.MAX_PARALLEL_DIALS - 1)
|
||||
dialer.releaseToken(tokens[0])
|
||||
dialer.releaseToken(tokens[0])
|
||||
expect(dialer.tokens).to.have.length(Constants.MAX_PARALLEL_DIALS)
|
||||
})
|
||||
|
||||
it('should be able to connect to a remote node via its multiaddr', async () => {
|
||||
const dialer = new Dialer({ transportManager: localTM })
|
||||
|
||||
|
Reference in New Issue
Block a user