Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
fix: some fixes for incorrect tests
Browse files Browse the repository at this point in the history
found these when debugging pull-multiplex
  • Loading branch information
dignifiedquire committed Jan 11, 2017
1 parent 4a0a05f commit 23a75d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
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 <[email protected]>",
"greenkeeperio-bot <[email protected]>"
]
}
}
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

0 comments on commit 23a75d1

Please sign in to comment.