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

fix: docs and adds test assertion that peer is a PeerId in return value from swarm.peers #230

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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