unittests/tests/JSONSerializer.js
branchpopcorn-port
changeset 75 f5a7299bd0ff
parent 69 3f7a2e8a948f
child 103 2dfd89e91c3a
--- a/unittests/tests/JSONSerializer.js	Thu Oct 13 17:12:52 2011 +0200
+++ b/unittests/tests/JSONSerializer.js	Thu Oct 13 17:13:44 2011 +0200
@@ -13,7 +13,7 @@
       equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct");
     });
     
-    test("sync() - callback should get called", function() {
+    test("sync()", function() {
       this.xhr = this.sandbox.useFakeXMLHttpRequest();
       this.requests = [];
       this.xhr.onCreate = function (request) {
@@ -37,4 +37,11 @@
       deepEqual(ser._data, response_array, "the internal variable is initialized to the correct value");
     });
 
+    test("currentMedia should return the current media", function() {
+      var ser = new IriSP.JSONSerializer(this.dt, "/url");
+      /* FIXME: actually get something instead of monkey-patching the struct */
+      ser._data = {}
+      ser._data.medias = [0];
+      equal(ser.currentMedia(), 0, "currentMedia() returns the correct value");
+    });
 };
\ No newline at end of file