Sha256: 62b8833ab5227045a31d2b27857d724153e0070f391769ade67ac797f69c6a8b

Contents?: true

Size: 1.5 KB

Versions: 7

Compression:

Stored size: 1.5 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Apple Inc. and contributors.
// License:   Licensed 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

7 entries across 7 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js