From a0a06d1285fcc85b7e87962bdc89f8584f607e83 Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 31 Mar 2017 09:36:43 +0100 Subject: [PATCH] feat: return the multiaddr in isConnected - usefulness --- src/index.js | 2 +- test/index.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 55ff55e..6560c92 100644 --- a/src/index.js +++ b/src/index.js @@ -30,7 +30,7 @@ class PeerInfo { } isConnected () { - return Boolean(this._connectedMultiaddr) + return this._connectedMultiaddr } } diff --git a/test/index.spec.js b/test/index.spec.js index 1ae895c..8a5dc80 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -259,9 +259,9 @@ describe('peer-info', () => { it('.connect .disconnect', () => { pi.multiaddrs.add('/ip4/127.0.0.1/tcp/5001') pi.connect('/ip4/127.0.0.1/tcp/5001') - expect(pi.isConnected()).to.equal(true) + expect(pi.isConnected()).to.exist() pi.disconnect() - expect(pi.isConnected()).to.equal(false) + expect(pi.isConnected()).to.not.exist() expect(() => pi.connect('/ip4/127.0.0.1/tcp/5001/ws')).to.throw() })