Sha256: 3475aab4f506ab9ed015657b63f4db1ba83e0af7386a63f64e2d7b36d7f2bef6

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple, Inc. and contributors.
// License:   Licened under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test MyApp */

var store, storeKey1,storeKey2;
var json1, json2;
var storeKey6, storeKey7;

module("SC.Store#cancelRecord", {
  setup: function() {
    
    store = SC.Store.create();
    
    json1 = {
      guid: "cancelGUID1",
      string: "string",
      number: 23,
      bool:   YES
    };
    json2 = {
      guid: "cancelGUID2",
      string: "string",
      number: 23,
      bool:   YES
    };
    
    storeKey1 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey1, json1, SC.Record.EMPTY);
    storeKey2 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey2, json2, SC.Record.READY_NEW);
    }
});

test("Check for error state handling and make sure that the method executes.", function() {
  var throwError=false;
  try{
    store.cancelRecord(undefined, undefined, storeKey1);
    throwError=false;
  }catch (error){
    throwError=true;
  }
  ok(throwError, "cancelRecord should throw and error if the record status is EMPTY or ERROR");
  try{
    store.cancelRecord(undefined, undefined, storeKey2);
    throwError=true;    
  }catch (error){
    throwError=false;
  }
  ok(throwError, " cancelRecord was succesfully executed.");
  
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js