unittests/tests/serializerFactory.js
author hamidouk
Tue, 29 Nov 2011 11:09:08 +0100
branchpopcorn-port
changeset 345 8a088f7daa66
parent 128 f3fec80dd31c
permissions -rw-r--r--
rollover over the interface buttons now works as expected. Also changed the width of the buttons to the correct size. Resized the width and height of the sprites to be the same as the boxes we display them in.
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
/* tests for the serializer factory */
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     2
function test_serializerFactory() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     3
  module("SerializerFactory tests", 
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     4
    { setup: function() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     5
              this.dt = new IriSP.DataLoader();
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
  test("test instantiation of a json serializer", function() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
     9
    var factory = new IriSP.SerializerFactory(this.dt);    
128
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    10
    var config = { type: "json", src : "/url" };
65
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    11
    var ser = factory.getSerializer(config);
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
    ok(ser instanceof IriSP.JSONSerializer, "returned object is instance of json serializer");    
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    14
  });
128
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    15
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    16
  test("test instantiation of a dummy serializer", function() {
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    17
    var factory = new IriSP.SerializerFactory(this.dt);    
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    18
    var config = { type: "dummy", src : "/url" };
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    19
    var ser = factory.getSerializer(config);
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    20
    
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    21
    ok(ser instanceof IriSP.MockSerializer, "returned object is instance of json serializer");    
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    22
  });
65
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    23
  
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    24
  test("test instantiation of a garbage serializer", function() {
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    25
    var factory = new IriSP.SerializerFactory(this.dt);    
128
f3fec80dd31c renames and inheritance bug fixes.
hamidouk
parents: 65
diff changeset
    26
    var config = {type: "garbage", src : "/url" };
65
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    27
    var ser = factory.getSerializer(config);
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    28
    
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    29
    equal(ser, undefined, "returned object is undefined");    
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    30
  });
6a8cae20f190 Added new unit tests and changes to the data classes.
hamidouk
parents:
diff changeset
    31
};