equal
deleted
inserted
replaced
11 var serializer = new IriSP.JSONSerializer(this.dt); |
11 var serializer = new IriSP.JSONSerializer(this.dt); |
12 |
12 |
13 equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct"); |
13 equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct"); |
14 }); |
14 }); |
15 |
15 |
16 test("sync() - callback should get called", function() { |
16 test("sync()", function() { |
17 this.xhr = this.sandbox.useFakeXMLHttpRequest(); |
17 this.xhr = this.sandbox.useFakeXMLHttpRequest(); |
18 this.requests = []; |
18 this.requests = []; |
19 this.xhr.onCreate = function (request) { |
19 this.xhr.onCreate = function (request) { |
20 this.requests.push(request); |
20 this.requests.push(request); |
21 }; |
21 }; |
35 ok(spy_callback.calledOnce, "callback called"); |
35 ok(spy_callback.calledOnce, "callback called"); |
36 ok(spy_callback.calledWith(response_array), "callback called with correct value"); |
36 ok(spy_callback.calledWith(response_array), "callback called with correct value"); |
37 deepEqual(ser._data, response_array, "the internal variable is initialized to the correct value"); |
37 deepEqual(ser._data, response_array, "the internal variable is initialized to the correct value"); |
38 }); |
38 }); |
39 |
39 |
|
40 test("currentMedia should return the current media", function() { |
|
41 var ser = new IriSP.JSONSerializer(this.dt, "/url"); |
|
42 /* FIXME: actually get something instead of monkey-patching the struct */ |
|
43 ser._data = {} |
|
44 ser._data.medias = [0]; |
|
45 equal(ser.currentMedia(), 0, "currentMedia() returns the correct value"); |
|
46 }); |
40 }; |
47 }; |