From 431aeef2b7e1228f10af1afb164aa6cdd45b5208 Mon Sep 17 00:00:00 2001 From: Tristan Cavelier <tristan.cavelier@tiolive.com> Date: Mon, 26 Aug 2013 12:03:20 +0200 Subject: [PATCH] jio job update tests added --- test/jio/tests.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/jio/tests.js b/test/jio/tests.js index 72168f9..0579cca 100644 --- a/test/jio/tests.js +++ b/test/jio/tests.js @@ -864,4 +864,47 @@ }); + test('Job Update', function () { + expect(4); + var clock, jio, o = {}; + clock = sinon.useFakeTimers(); + + jio = new JIO({ + "type": "fake", + "id": "Job Update" + }, { + "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 Update/put"]; + ok(o.first_put_command, "First command called"); + o.first_put_command.free(); + + jio.put({"_id": "a"}).always(function (answer) { + deepEqual(answer, { + "id": "a", + "ok": true, + "status": 200, + "statusText": "Ok" + }, "Second put respond"); + }); + + clock.tick(1); + ok(fakestorage['Job Update/put'] === undefined, + 'Second command not called'); + o.first_put_command.success(); + clock.tick(1); + + }); + })); -- 2.30.9