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

Commit cdf6864

Browse files
author
Pedro Santos
committed
chore: more code review changes
1 parent 2b4fbf5 commit cdf6864

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@
3636
},
3737
"homepage": "https://github.com/ipfs/interface-ipfs-core#readme",
3838
"dependencies": {
39-
"async": "^2.6.2",
4039
"bs58": "^4.0.1",
4140
"chai": "^4.2.0",
4241
"chai-as-promised": "^7.1.1",
4342
"cids": "~0.7.1",
44-
"concat-stream": "^2.0.0",
4543
"delay": "^4.3.0",
4644
"dirty-chai": "^2.0.1",
4745
"es6-promisify": "^6.0.2",

src/dag/put.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,20 @@ module.exports = (common, options) => {
2828
let pbNode
2929
let cborNode
3030

31-
before(() => {
31+
before((done) => {
3232
const someData = Buffer.from('some data')
3333

34-
return new Promise((resolve, reject) => {
35-
try {
36-
pbNode = new DAGNode(someData)
37-
} catch (err) {
38-
return reject(err)
39-
}
34+
try {
35+
pbNode = new DAGNode(someData)
36+
} catch (err) {
37+
return done(err)
38+
}
4039

41-
cborNode = {
42-
data: someData
43-
}
40+
cborNode = {
41+
data: someData
42+
}
4443

45-
resolve()
46-
})
44+
done()
4745
})
4846

4947
it('should put dag-pb with default hash func (sha2-256)', () => {

src/files-regular/get-readable-stream.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
'use strict'
33

44
const { fixtures } = require('./utils')
5-
const concat = require('concat-stream')
65
const through = require('through2')
76
const { getDescribe, getIt, expect } = require('../utils/mocha')
7+
const getStream = require('get-stream')
88

99
/** @typedef { import("ipfsd-ctl").TestsInterface } TestsInterface */
1010
/**
@@ -35,11 +35,10 @@ module.exports = (common, options) => {
3535
// to 'pump' module that get-stream uses
3636
const files = await new Promise((resolve, reject) => {
3737
const filesArr = []
38-
stream.pipe(through.obj((file, enc, next) => {
39-
file.content.pipe(concat((content) => {
40-
filesArr.push({ path: file.path, content: content })
41-
next()
42-
}))
38+
stream.pipe(through.obj(async (file, enc, next) => {
39+
const content = await getStream.buffer(file.content)
40+
filesArr.push({ path: file.path, content: content })
41+
next()
4342
}, () => resolve(filesArr)))
4443
})
4544

src/swarm/peers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module.exports = (common, options) => {
2525
ipfsA = await common.setup()
2626
ipfsB = await common.setup()
2727
await ipfsA.swarm.connect(ipfsB.peerId.addresses[0])
28+
await delay(60 * 1000) // wait for open streams in the connection available
2829
})
2930

3031
after(() => common.teardown())
@@ -53,7 +54,7 @@ module.exports = (common, options) => {
5354
expect(multiaddr.isMultiaddr(peer.addr)).to.equal(true)
5455
expect(peer).to.have.a.property('peer')
5556
expect(peer).to.have.a.property('latency')
56-
expect(peer.latency).to.match(/n\/a|[0-9]+m?s/) // n/a or 3ms or 3s
57+
expect(peer.latency).to.match(/n\/a|[0-9]+[mµ]?s/) // n/a or 3ms or 3µs or 3s
5758
expect(peer).to.have.a.property('muxer')
5859
expect(peer).to.have.a.property('streams')
5960
})

0 commit comments

Comments
 (0)