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.

/* tests for the serializer factory */
function test_serializerFactory() {
  module("SerializerFactory tests", 
    { setup: function() {
              this.dt = new IriSP.DataLoader();
  }}); 
  
  test("test instantiation of a json serializer", function() {
    var factory = new IriSP.SerializerFactory(this.dt);    
    var config = { type: "json", src : "/url" };
    var ser = factory.getSerializer(config);
    
    ok(ser instanceof IriSP.JSONSerializer, "returned object is instance of json serializer");    
  });

  test("test instantiation of a dummy serializer", function() {
    var factory = new IriSP.SerializerFactory(this.dt);    
    var config = { type: "dummy", src : "/url" };
    var ser = factory.getSerializer(config);
    
    ok(ser instanceof IriSP.MockSerializer, "returned object is instance of json serializer");    
  });
  
  test("test instantiation of a garbage serializer", function() {
    var factory = new IriSP.SerializerFactory(this.dt);    
    var config = {type: "garbage", src : "/url" };
    var ser = factory.getSerializer(config);
    
    equal(ser, undefined, "returned object is undefined");    
  });
};