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

[WIP] fix: some fixes for incorrect tests #34

Merged
merged 1 commit into from
Jan 16, 2017
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
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
"multiaddr": "^2.1.0",
"pull-generate": "^2.2.0",
"pull-pair": "^1.1.0",
"pull-stream": "^3.5.0",
"run-parallel": "^1.1.6",
"run-series": "^1.1.4"
},
"pull-stream": "^3.5.0"
},
"devDependencies": {
"aegir": "^9.3.0"
},
Expand All @@ -51,4 +49,4 @@
"Jeffrey Hulten <jhulten@gmail.com>",
"greenkeeperio-bot <support@greenkeeper.io>"
]
}
}
13 changes: 7 additions & 6 deletions src/base-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ module.exports = (common) => {
expect(err).to.not.exist.mark()
})

pull(
pull.values(['hey']),
dialerConn
)

listener.on('stream', (stream) => {
pull(
stream,
Expand All @@ -125,12 +120,13 @@ module.exports = (common) => {
expect(err).to.not.exist.mark()
})

dialer.on('stream', onDialerStream)

pull(
pull.values(['hello']),
listenerConn
)

dialer.on('stream', onDialerStream)
function onDialerStream (stream) {
pull(
stream,
Expand All @@ -141,6 +137,11 @@ module.exports = (common) => {
)
}
})

pull(
pull.values(['hey']),
dialerConn
)
})
})
}
4 changes: 2 additions & 2 deletions src/close-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ chai.use(require('chai-checkmark'))
const expect = chai.expect
const pair = require('pull-pair/duplex')
const pull = require('pull-stream')
const parallel = require('run-parallel')
const series = require('run-series')
const parallel = require('async/parallel')
const series = require('async/series')
const Tcp = require('libp2p-tcp')
const multiaddr = require('multiaddr')

Expand Down
5 changes: 4 additions & 1 deletion src/spawner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const pull = require('pull-stream')
const generate = require('pull-generate')
const each = require('async/each')
const eachLimit = require('async/eachLimit')
const setImmediate = require('async/setImmediate')

module.exports = (muxer, nStreams, nMsg, done, limit) => {
const p = pair()
Expand Down Expand Up @@ -50,7 +51,9 @@ module.exports = (muxer, nStreams, nMsg, done, limit) => {
check()
pull(
generate(0, (s, cb) => {
cb(s === nMsg ? true : null, msg, s + 1)
setImmediate(() => {
cb(s === nMsg ? true : null, msg, s + 1)
})
}),
stream,
pull.collect((err, res) => {
Expand Down