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

Commit

Permalink
feat: upgrade to aegir@9
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Nov 8, 2016
1 parent 6aa1aac commit a6f8c27
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ build/Release
node_modules

dist
lib
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Peer Book JavaScript Implementation
[![Coverage Status](https://coveralls.io/repos/github/libp2p/js-peer-book/badge.svg?branch=master)](https://coveralls.io/github/libp2p/js-peer-book?branch=master)
[![Dependency Status](https://david-dm.org/libp2p/js-peer-book.svg?style=flat-square)](https://david-dm.org/libp2p/js-peer-book)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D4.0.0-orange.svg?style=flat-square)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/js-peer-book.svg)](https://saucelabs.com/u/js-peer-book)

> Peer Store for libp2p and IPFS
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "peer-book",
"version": "0.3.0",
"description": "Peer Store for libp2p and IPFS",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"main": "src/index.js",
"directories": {
"test": "test"
},
Expand Down Expand Up @@ -42,12 +41,13 @@
},
"devDependencies": {
"aegir": "^9.1.1",
"async": "^2.1.2",
"chai": "^3.5.0",
"multiaddr": "^2.0.2",
"peer-info": "^0.7.0",
"pre-commit": "^1.1.2"
"multiaddr": "^2.0.3",
"peer-info": "^0.8.0",
"pre-commit": "^1.1.3"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>"
]
}
}
35 changes: 26 additions & 9 deletions test/peer-book.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,39 @@
'use strict'

const expect = require('chai').expect
const PeerBook = require('../src')
const Multiaddr = require('multiaddr')
const PeerInfo = require('peer-info')
const async = require('async')

const PeerBook = require('../src')

describe('peer-book', function () {
this.timeout(50000)
let pb
let p1
let p2
let p3
let p4

before((done) => {
async.parallel([
(cb) => PeerInfo.create(cb),
(cb) => PeerInfo.create(cb),
(cb) => PeerInfo.create(cb),
(cb) => PeerInfo.create(cb)
], (err, infos) => {
if (err) {
return done(err)
}

p1 = infos[0]
p2 = infos[1]
p3 = infos[2]
p4 = infos[3]

done()
})
})

it('create PeerBook', (done) => {
pb = new PeerBook()
Expand All @@ -20,10 +43,6 @@ describe('peer-book', function () {
})

it('put peerInfo', (done) => {
p1 = new PeerInfo()
p2 = new PeerInfo()
p3 = new PeerInfo()

pb.put(p1)
pb.put(p2)
pb.put(p3)
Expand All @@ -45,9 +64,8 @@ describe('peer-book', function () {
})

it('getByB58String non existent', (done) => {
const peer = new PeerInfo()
try {
pb.getByB58String(peer.id.toB58String())
pb.getByB58String(p4.id.toB58String())
} catch (err) {
expect(err).to.exist
done()
Expand All @@ -62,9 +80,8 @@ describe('peer-book', function () {
})

it('getByMultihash non existent', (done) => {
const peer = new PeerInfo()
try {
pb.getByMultihash(peer.id.toBytes())
pb.getByMultihash(p4.id.toBytes())
} catch (err) {
expect(err).to.exist
done()
Expand Down

0 comments on commit a6f8c27

Please sign in to comment.