Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: fixes doc and adds test assertion that peer is a PeerId in retur…
Browse files Browse the repository at this point in the history
…n value from swarm.peers (#230)
  • Loading branch information
alanshaw authored and daviddias committed Mar 7, 2018
1 parent 19318eb commit db530d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SPEC/SWARM.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ If `opts.verbose` is set to `true` additional information, such as `latency` is
`callback` must follow `function (err, peerInfos) {}` signature, where `err` is an error if the operation was not successful. `peerInfos` will be an array of the form

- `addr: Multiaddr`
- `peer: [PeerInfo]()`
- `peer: PeerId`
- `latency: String` Only if `verbose: true` was passed

Starting with `go-ipfs 0.4.5` these additional properties are provided
Expand Down
2 changes: 2 additions & 0 deletions js/src/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const expect = chai.expect
chai.use(dirtyChai)
const series = require('async/series')
const multiaddr = require('multiaddr')
const PeerId = require('peer-id')
const os = require('os')
const path = require('path')
const hat = require('hat')
Expand Down Expand Up @@ -79,6 +80,7 @@ module.exports = (common) => {
expect(peer).to.have.a.property('addr')
expect(multiaddr.isMultiaddr(peer.addr)).to.equal(true)
expect(peer).to.have.a.property('peer')
expect(PeerId.isPeerId(peer.peer)).to.equal(true)
expect(peer).to.not.have.a.property('latency')

// only available in 0.4.5
Expand Down

0 comments on commit db530d7

Please sign in to comment.