Skip to content

Commit

Permalink
remove packetsInOrder option and use callback
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Jul 24, 2024
1 parent 4b1efcd commit ca31a6b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions abstractTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module.exports = function abstractTests (opts) {
const builder = opts.builder
const test = opts.test
const packetsInOrder = opts.packetsInOrder === undefined ? true : opts.packetsInOrder

test('support on and emit', function (t) {
t.plan(4)
Expand Down Expand Up @@ -504,7 +503,7 @@ module.exports = function abstractTests (opts) {

e.on(topic, function (msg, cb) {
let fail = false
if (packetsInOrder && received !== msg.payload) {
if (received !== msg.payload) {
t.fail(`leak detected. Count: ${received} - Payload: ${msg.payload}`)
fail = true
}
Expand All @@ -517,11 +516,11 @@ module.exports = function abstractTests (opts) {
})
}
cb()
}, function () {
for (let payload = 0; payload < total; payload++) {
e.emit({ topic, payload })
}
})

for (let payload = 0; payload < total; payload++) {
e.emit({ topic, payload })
}
})

test('calling emit without cb when closed doesn\'t throw error', function (t) {
Expand Down

0 comments on commit ca31a6b

Please sign in to comment.