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.

/* 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");    
  });
};