How do I program the scenario where I have an action that spawns two asynchronous callbacks and I want the test to end when both callbacks have been called?
asyncTest('Do two asynchronous things', 2, function() {
doTwoThings(callback1, callback2);
function callback1() {
ok(true, 'dummy test');
start();
}
function callback2() {
ok(true, 'dummy test');
start();
}
});
The answer is to call stop with the number of additional starts you expect. asyncTest expects one start so for my case I have to add another call to stop.
asyncTest('Do two asynchronous things', 2, function() {
stop()
doTwoThings(callback1, callback2);
function callback1() {
ok(true, 'dummy test');
start();
}
function callback2() {
ok(true, 'dummy test');
start();
}
});