Skip to content

Commit a767cee

Browse files
jacobheunvasco-santos
authored andcommitted
chore: update dependencies and fix libp2p test usage (#64)
1 parent a718402 commit a767cee

File tree

11 files changed

+40
-116
lines changed

11 files changed

+40
-116
lines changed

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

appveyor.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

benchmarks/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ map([0, 1], (i, cb) => {
5757

5858
suite
5959
.on('cycle', (event) => {
60-
console.log(String(event.target))
60+
console.log(String(event.target)) // eslint-disable-line
6161
})
6262
.on('complete', () => {
6363
process.exit()

benchmarks/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ suite.add('randomSeqno', () => {
1919

2020
suite
2121
.on('cycle', (event) => {
22-
console.log(String(event.target))
22+
console.log(String(event.target)) // eslint-disable-line
2323
res = []
2424
})
2525
.run({

circle.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

package.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"coverage-publish": "aegir coverage --provider coveralls"
1919
},
2020
"pre-push": [
21-
"lint",
22-
"test"
21+
"lint"
2322
],
2423
"repository": {
2524
"type": "git",
@@ -39,24 +38,24 @@
3938
},
4039
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
4140
"devDependencies": {
42-
"aegir": "^13.0.6",
41+
"aegir": "^17.1.1",
4342
"benchmark": "^2.1.4",
44-
"chai": "^4.1.2",
43+
"chai": "^4.2.0",
4544
"dirty-chai": "^2.0.1",
46-
"libp2p": "~0.19.2",
47-
"libp2p-secio": "~0.10.0",
48-
"libp2p-spdy": "~0.12.1",
49-
"libp2p-tcp": "~0.12.0",
50-
"peer-id": "~0.10.7",
51-
"peer-info": "~0.14.0"
45+
"libp2p": "~0.24.1",
46+
"libp2p-secio": "~0.10.1",
47+
"libp2p-spdy": "~0.13.1",
48+
"libp2p-tcp": "~0.13.0",
49+
"peer-id": "~0.12.0",
50+
"peer-info": "~0.15.0"
5251
},
5352
"dependencies": {
54-
"async": "^2.6.0",
53+
"async": "^2.6.1",
5554
"bs58": "^4.0.1",
56-
"debug": "^3.1.0",
57-
"length-prefixed-stream": "^1.5.2",
58-
"libp2p-crypto": "~0.13.0",
59-
"lodash": "^4.3.0",
55+
"debug": "^4.1.0",
56+
"length-prefixed-stream": "^1.6.0",
57+
"libp2p-crypto": "~0.14.1",
58+
"lodash": "^4.17.11",
6059
"protons": "^1.0.1",
6160
"pull-pushable": "^2.2.0",
6261
"time-cache": "~0.3.0"

src/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class BaseProtocol extends EventEmitter {
2020
* @param {String} debugName
2121
* @param {String} multicodec
2222
* @param {Object} libp2p
23-
* @returns {FloodSub}
23+
* @constructor
2424
*/
2525
constructor (debugName, multicodec, libp2p) {
2626
super()

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const setImmediate = require('async/setImmediate')
2222
class FloodSub extends BaseProtocol {
2323
/**
2424
* @param {Object} libp2p
25-
* @returns {FloodSub}
25+
* @constructor
2626
*/
2727
constructor (libp2p) {
2828
super('libp2p:floodsub', multicodec, libp2p)

test/2-nodes.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const utils = require('./utils')
1414
const first = utils.first
1515
const createNode = utils.createNode
1616
const expectSet = utils.expectSet
17-
const Buffer = require('safe-buffer').Buffer
1817

1918
describe('basics between 2 nodes', () => {
2019
describe('fresh nodes', () => {
@@ -97,7 +96,7 @@ describe('basics between 2 nodes', () => {
9796

9897
fsB.once('Z', shouldNotHappen)
9998

100-
fsA.publish('Z', new Buffer('hey'))
99+
fsA.publish('Z', Buffer.from('hey'))
101100
})
102101

103102
it('Publish to a topic:Z in nodeB', (done) => {
@@ -114,7 +113,7 @@ describe('basics between 2 nodes', () => {
114113

115114
fsB.once('Z', shouldNotHappen)
116115

117-
fsB.publish('Z', new Buffer('banana'))
116+
fsB.publish('Z', Buffer.from('banana'))
118117
})
119118

120119
it('Publish 10 msg to a topic:Z in nodeB', (done) => {
@@ -137,7 +136,7 @@ describe('basics between 2 nodes', () => {
137136
}
138137
}
139138

140-
times(10, () => fsB.publish('Z', new Buffer('banana')))
139+
times(10, () => fsB.publish('Z', Buffer.from('banana')))
141140
})
142141

143142
it('Publish 10 msg to a topic:Z in nodeB as array', (done) => {
@@ -161,7 +160,7 @@ describe('basics between 2 nodes', () => {
161160
}
162161

163162
let msgs = []
164-
times(10, () => msgs.push(new Buffer('banana')))
163+
times(10, () => msgs.push(Buffer.from('banana')))
165164
fsB.publish('Z', msgs)
166165
})
167166

@@ -189,8 +188,8 @@ describe('basics between 2 nodes', () => {
189188
done()
190189
}, 100)
191190

192-
fsB.publish('Z', new Buffer('banana'))
193-
fsA.publish('Z', new Buffer('banana'))
191+
fsB.publish('Z', Buffer.from('banana'))
192+
fsA.publish('Z', Buffer.from('banana'))
194193
})
195194

196195
it('stop both FloodSubs', (done) => {
@@ -208,10 +207,12 @@ describe('basics between 2 nodes', () => {
208207
let fsB
209208

210209
before((done) => {
211-
series([
210+
parallel([
212211
(cb) => createNode('/ip4/127.0.0.1/tcp/0', cb),
213212
(cb) => createNode('/ip4/127.0.0.1/tcp/0', cb)
214-
], (cb, nodes) => {
213+
], (err, nodes) => {
214+
expect(err).to.not.exist()
215+
215216
nodeA = nodes[0]
216217
nodeB = nodes[1]
217218

test/nodejs-bundle.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ const secio = require('libp2p-secio')
66
const libp2p = require('libp2p')
77

88
class Node extends libp2p {
9-
constructor (peerInfo, peerBook, options) {
10-
options = options || {}
11-
9+
constructor ({ peerInfo, peerBook }) {
1210
const modules = {
13-
transport: [new TCP()],
14-
connection: {
15-
muxer: spdy,
16-
crypto: [ secio ]
17-
}
11+
transport: [TCP],
12+
streamMuxer: [spdy],
13+
connEncryption: [secio]
1814
}
1915

20-
super(modules, peerInfo, peerBook, options)
16+
super({
17+
modules,
18+
peerInfo,
19+
peerBook
20+
})
2121
}
2222
}
2323

test/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ exports.createNode = (maddr, callback) => {
1616
waterfall([
1717
(cb) => PeerId.create({ bits: 1024 }, cb),
1818
(id, cb) => PeerInfo.create(id, cb),
19-
(peer, cb) => {
20-
peer.multiaddrs.add(maddr)
21-
cb(null, new Node(peer))
19+
(peerInfo, cb) => {
20+
peerInfo.multiaddrs.add(maddr)
21+
cb(null, new Node({ peerInfo }))
2222
},
2323
(node, cb) => node.start((err) => cb(err, node))
2424
], callback)

0 commit comments

Comments
 (0)