Skip to content

Commit

Permalink
Keep tests from calling done() twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallswain committed Feb 12, 2015
1 parent 30346d0 commit 9bd878c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion test/providers/primus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,16 @@ describe('Primus provider', function () {
socket.send('tasks::remove', 1, {}, function() {});
socket.send('tasks::remove', 23, {}, function() {});

var ready = false;

socket.on('tasks removed', function (data) {
service.removed = oldRemoved;
assert.equal(data.id, 23);
done();
console.log('Ready: ' + ready);
if (ready) {
done();
}
ready = true;
});
});
});
Expand Down
7 changes: 6 additions & 1 deletion test/providers/socketio.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,15 @@ describe('SocketIO provider', function () {
socket.emit('tasks::remove', 1, {}, function() {});
socket.emit('tasks::remove', 23, {}, function() {});

var ready = false;

socket.on('tasks removed', function (data) {
service.removed = oldRemoved;
assert.equal(data.id, 23);
done();
if (ready) {
done();
}
ready = true;
});
});
});
Expand Down

0 comments on commit 9bd878c

Please sign in to comment.