Commit d9eb65a6 authored by Tristan Cavelier's avatar Tristan Cavelier

JIO job wait tests added

parent 535834c0
...@@ -907,4 +907,50 @@ ...@@ -907,4 +907,50 @@
}); });
test('Job Wait', function () {
expect(5);
var clock, jio, o = {};
clock = sinon.useFakeTimers();
jio = new JIO({
"type": "fake",
"id": "Job Wait"
}, {
"workspace": {}
});
jio.put({"_id": "a"}).always(function (answer) {
deepEqual(answer, {
"id": "a",
"ok": true,
"status": 200,
"statusText": "Ok"
}, "First put respond");
});
clock.tick(1);
o.first_put_command = fakestorage["Job Wait/put"];
ok(o.first_put_command, "First command called");
o.first_put_command.free();
jio.put({"_id": "a", "a": "b"}).always(function (answer) {
deepEqual(answer, {
"id": "a",
"ok": true,
"status": 200,
"statusText": "Ok"
}, "Second put respond");
});
clock.tick(1);
ok(fakestorage['Job Wait/put'] === undefined,
'Second command not called yet');
o.first_put_command.success();
clock.tick(1);
ok(fakestorage['Job Wait/put'], 'Second command called');
fakestorage['Job Wait/put'].success();
clock.tick(1);
});
})); }));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment