Skip to content

Commit a0cc715

Browse files
author
Ruben Bridgewater
committed
Ignore still running commands for pub sub tests after the test ended
1 parent 4ba7270 commit a0cc715

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/pubsub.spec.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,18 @@ describe("publish/subscribe", function () {
124124
it('receives messages if subscribe is called after unsubscribe', function (done) {
125125
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
126126

127+
var end = helper.callFuncAfter(done, 2);
127128
sub.once("subscribe", function (chnl, count) {
128-
pub.publish(channel, message, helper.isNumber(1));
129+
pub.publish(channel, message, function (err, res) {
130+
helper.isNumber(1)(err, res);
131+
end();
132+
});
129133
});
130134

131135
sub.on("message", function (chnl, msg) {
132136
assert.equal(chnl, channel);
133137
assert.equal(msg, message);
134-
return done();
138+
end();
135139
});
136140

137141
sub.subscribe(channel);
@@ -371,8 +375,9 @@ describe("publish/subscribe", function () {
371375
});
372376

373377
afterEach(function () {
374-
sub.end(true);
375-
pub.end(true);
378+
// Explicitly ignore still running commands
379+
pub.end(false);
380+
sub.end(false);
376381
});
377382
});
378383
});

0 commit comments

Comments
 (0)