Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.

Commit a0a06d1

Browse files
committed
feat: return the multiaddr in isConnected - usefulness
1 parent 2d1f86c commit a0a06d1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PeerInfo {
3030
}
3131

3232
isConnected () {
33-
return Boolean(this._connectedMultiaddr)
33+
return this._connectedMultiaddr
3434
}
3535
}
3636

test/index.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ describe('peer-info', () => {
259259
it('.connect .disconnect', () => {
260260
pi.multiaddrs.add('/ip4/127.0.0.1/tcp/5001')
261261
pi.connect('/ip4/127.0.0.1/tcp/5001')
262-
expect(pi.isConnected()).to.equal(true)
262+
expect(pi.isConnected()).to.exist()
263263
pi.disconnect()
264-
expect(pi.isConnected()).to.equal(false)
264+
expect(pi.isConnected()).to.not.exist()
265265
expect(() => pi.connect('/ip4/127.0.0.1/tcp/5001/ws')).to.throw()
266266
})
267267

0 commit comments

Comments
 (0)