unittests/tests/serializers/mockTweetSerializer.js
author hamidouk
Mon, 14 Nov 2011 12:26:17 +0100
branchpopcorn-port
changeset 234 43b198dc932d
permissions -rw-r--r--
reorganized the layout of the test directories to follow the layout the source code.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
234
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     1
function test_mockTweetSerializer() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     2
  module("Mock Tweet Serializer basic tests");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     3
  
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     4
  test("init the serializer with a DataLoader and an url", function() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     5
      var dt = new IriSP.DataLoader();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     6
      var ser = new IriSP.MockTweetSerializer(dt, "http://google.com");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     7
      equal( ser._DataLoader, dt, "The dataloader reference is copied to the object." );
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     8
      equal( ser._url, "http://google.com", "The url has been copied as well." );
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
     9
      ok(ser._data, "the mock data is defined");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    10
  });
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    11
  
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    12
  test("check that the serialize and deserialize abstract functions are defined", function() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    13
      var dt = new IriSP.DataLoader();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    14
      var ser = new IriSP.MockTweetSerializer(dt);
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    15
      notEqual(ser.serialize, undefined, ".serialize is defined");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    16
      notEqual(ser.deserialize, undefined, ".deserialize is defined");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    17
  });
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    18
  
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    19
  test("check that the callback is called", function() {
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    20
      var dt = new IriSP.DataLoader();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    21
      var ser = new IriSP.MockTweetSerializer(dt);
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    22
      var spy = this.spy();
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    23
      ser.sync(spy);
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    24
      ok(spy.called, "the callback has been called");
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    25
  });
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    26
43b198dc932d reorganized the layout of the test directories to follow the layout the source
hamidouk
parents:
diff changeset
    27
};