unittests/mockSerializer.js
branchpopcorn-port
changeset 157 73bce42a3ed3
parent 128 f3fec80dd31c
child 182 5fc357f62af1
equal deleted inserted replaced
156:0e6a4d1e4dbe 157:73bce42a3ed3
     2    because the stub data is huge an we don't want to ship it with the rest
     2    because the stub data is huge an we don't want to ship it with the rest
     3    of the app */
     3    of the app */
     4 
     4 
     5 IriSP.MockSerializer = function(DataLoader, url) {
     5 IriSP.MockSerializer = function(DataLoader, url) {
     6   IriSP.Serializer.call(this, DataLoader, url);
     6   IriSP.Serializer.call(this, DataLoader, url);
       
     7   this._data = _data;
       
     8 };
     7 
     9 
     8   this._data = { "tags": [
    10 IriSP.MockSerializer.prototype = new IriSP.Serializer();   
       
    11 
       
    12 IriSP.MockSerializer.prototype.currentMedia = function() {
       
    13   return this._data.medias[0];
       
    14 };
       
    15 
       
    16 // Copy some methods from JSONSerializer because we need them in
       
    17 // some tests.
       
    18 
       
    19 IriSP.MockSerializer.prototype.searchAnnotations = IriSP.JSONSerializer.prototype.searchAnnotations;
       
    20 IriSP.MockSerializer.prototype.searchOccurences = IriSP.JSONSerializer.prototype.searchOccurences;
       
    21 
       
    22 var _data = { "tags": [
     9       {
    23       {
    10           "meta": {
    24           "meta": {
    11             "dc:contributor": "IRI ", 
    25             "dc:contributor": "IRI ", 
    12             "dc:created": "2010-09-06T15:53:44.618963", 
    26             "dc:created": "2010-09-06T15:53:44.618963", 
    13             "dc:title": "suffrage universel", 
    27             "dc:title": "suffrage universel", 
  1456           "id": "c_DE60F95E-73B8-922D-3AC7-6FB197A1BF16", 
  1470           "id": "c_DE60F95E-73B8-922D-3AC7-6FB197A1BF16", 
  1457           "dc:created": "2010-09-06T15:53:44.699595", 
  1471           "dc:created": "2010-09-06T15:53:44.699595", 
  1458           "dc:description": "", 
  1472           "dc:description": "", 
  1459           "dc:modified": "2010-09-06T15:53:44.699595"
  1473           "dc:modified": "2010-09-06T15:53:44.699595"
  1460         }
  1474         }
  1461       ]
  1475       ]};
  1462 };
       
  1463 };
       
  1464 
       
  1465 IriSP.MockSerializer.prototype = new IriSP.Serializer();   
       
  1466 
       
  1467 IriSP.MockSerializer.prototype.currentMedia = function() {
       
  1468   return this._data.medias[0];
       
  1469 };