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

Commit db530d7

Browse files
alanshawdaviddias
authored andcommitted
fix: fixes doc and adds test assertion that peer is a PeerId in return value from swarm.peers (#230)
1 parent 19318eb commit db530d7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

SPEC/SWARM.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ If `opts.verbose` is set to `true` additional information, such as `latency` is
8888
`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
8989

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

9494
Starting with `go-ipfs 0.4.5` these additional properties are provided

js/src/swarm.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const expect = chai.expect
99
chai.use(dirtyChai)
1010
const series = require('async/series')
1111
const multiaddr = require('multiaddr')
12+
const PeerId = require('peer-id')
1213
const os = require('os')
1314
const path = require('path')
1415
const hat = require('hat')
@@ -79,6 +80,7 @@ module.exports = (common) => {
7980
expect(peer).to.have.a.property('addr')
8081
expect(multiaddr.isMultiaddr(peer.addr)).to.equal(true)
8182
expect(peer).to.have.a.property('peer')
83+
expect(PeerId.isPeerId(peer.peer)).to.equal(true)
8284
expect(peer).to.not.have.a.property('latency')
8385

8486
// only available in 0.4.5

0 commit comments

Comments
 (0)