diff --git a/API/swarm/README.md b/API/swarm/README.md index 9def0edcb..37feb9921 100644 --- a/API/swarm/README.md +++ b/API/swarm/README.md @@ -9,7 +9,7 @@ Swarm API ##### `JavaScript` - ipfs.swarm.addrs([callback]) -`callback` must follow `function (err, addrs) {}` signature, where `err` is an error if the operation was not successful. `addrs` will be an array of multiaddrs. +`callback` must follow `function (err, addrs) {}` signature, where `err` is an error if the operation was not successful. `addrs` will be an array of [`PeerInfo`](https://github.com/libp2p/js-peer-info)s. If no `callback` is passed, a promise is returned. @@ -29,7 +29,7 @@ ipfs.swarm.addrs(function (err, addrs) {}) Where `addr` is of type [multiaddr](https://github.com/multiformats/js-multiaddr) -`callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. +`callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. If no `callback` is passed, a promise is returned. @@ -51,7 +51,7 @@ ipfs.swarm.connect(addr, function (err) { Where `addr` is of type [multiaddr](https://github.com/multiformats/js-multiaddr) -`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful. +`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful. If no `callback` is passed, a promise is returned. @@ -111,7 +111,7 @@ ipfs.swarm.filters(function (err, filters) {}) Where `filter` is of type [multiaddr]() -`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful. +`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful. If no `callback` is passed, a promise is returned. @@ -140,5 +140,3 @@ Example: ```JavaScript ipfs.swarm.filters.rm(filter, function (err) {}) ``` - - diff --git a/src/swarm.js b/src/swarm.js index aab7b16a7..e0864d3ef 100644 --- a/src/swarm.js +++ b/src/swarm.js @@ -46,6 +46,7 @@ module.exports = (common) => { it('.connect', (done) => { ipfsB.id((err, id) => { expect(err).to.not.exist + const ipfsBAddr = id.addresses[0] ipfsA.swarm.connect(ipfsBAddr, done) }) @@ -62,7 +63,9 @@ module.exports = (common) => { it('.addrs', (done) => { ipfsA.swarm.addrs((err, multiaddrs) => { expect(err).to.not.exist - expect(multiaddrs).to.have.length.above(0) + expect(multiaddrs).to.not.be.empty + expect(multiaddrs).to.be.an('array') + expect(multiaddrs[0].constructor.name).to.be.eql('Peer') done() }) })