unittests/tests/JSONSerializer.js
author hamidouk
Wed, 12 Oct 2011 11:54:26 +0200
branchpopcorn-port
changeset 65 6a8cae20f190
child 69 3f7a2e8a948f
permissions -rw-r--r--
Added new unit tests and changes to the data classes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     1
function test_JSONSerializer() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     2
  module("JSON Serializer tests", 
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     3
    { setup: function() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     4
      this.dt = new IriSP.DataLoader();
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     5
      }
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     6
    }
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     7
    );    
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     8
    
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     9
    test("should return the correct JSON", function() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    10
      var arr = ["ab", {"de" : "fg"}, "lp"];
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    11
      var serializer = new IriSP.JSONSerializer(this.dt);
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    12
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    13
      equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct");
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    14
    });
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    15
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    16
};