unittests/tests/serializerFactory.js
author hamidouk
Mon, 19 Dec 2011 15:25:22 +0100
branchpopcorn-port
changeset 481 a46cfeee6d77
parent 128 f3fec80dd31c
permissions -rw-r--r--
using jquery ui draggable changes the state of an element from absolute to relative positioning, which breaks the way our seek button expands itself, so we need to force absolute positioning, quite uglily, using jquery.
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
};