Permalink
Browse files

Update failing specs to reflect error callback changes

Related change: 75417f6
  • Loading branch information...
1 parent 2e55c2d commit 19fdec0a6a679b12883f669ab6bb693fb0600a5f @nilbus committed May 3, 2015
Showing with 11 additions and 7 deletions.
  1. +5 −3 spec/dualsync_spec.coffee
  2. +6 −4 spec/dualsync_spec.js
@@ -366,7 +366,9 @@ describe 'when to call user-specified success and error callbacks', ->
it 'uses the success callback if the store exists with data', ->
storeModel = model.clone()
storeModel.storeName = 'store-exists'
- localStorage.setItem storeModel.storeName, "1,2,3"
+ modelId = storeModel.id
+ localStorage.setItem storeModel.storeName, modelId
+ localStorage.setItem "#{storeModel.storeName}#{modelId}", "{\"id\": #{modelId}}"
ready = false
runs ->
dualsync('read', storeModel,
@@ -375,14 +377,14 @@ describe 'when to call user-specified success and error callbacks', ->
)
waitsFor (-> ready), "The success callback should have been called", 100
- it 'success if server errors and Store exists with no entries', ->
+ it 'errors if the model has not been cached locally', ->
storeModel = model.clone()
storeModel.storeName = 'store-exists'
localStorage.setItem storeModel.storeName, ""
ready = false
runs ->
dualsync('read', storeModel,
- success: (-> ready = true)
+ error: (-> ready = true)
errorStatus: 0
)
waitsFor (-> ready), "The success callback should have been called", 100
View
@@ -706,10 +706,12 @@
}), "The error callback should have been called", 100);
});
it('uses the success callback if the store exists with data', function() {
- var ready, storeModel;
+ var modelId, ready, storeModel;
storeModel = model.clone();
storeModel.storeName = 'store-exists';
- localStorage.setItem(storeModel.storeName, "1,2,3");
+ modelId = storeModel.id;
+ localStorage.setItem(storeModel.storeName, modelId);
+ localStorage.setItem("" + storeModel.storeName + modelId, "{\"id\": " + modelId + "}");
ready = false;
return runs(function() {
dualsync('read', storeModel, {
@@ -723,15 +725,15 @@
}), "The success callback should have been called", 100);
});
});
- return it('success if server errors and Store exists with no entries', function() {
+ return it('errors if the model has not been cached locally', function() {
var ready, storeModel;
storeModel = model.clone();
storeModel.storeName = 'store-exists';
localStorage.setItem(storeModel.storeName, "");
ready = false;
return runs(function() {
dualsync('read', storeModel, {
- success: (function() {
+ error: (function() {
return ready = true;
}),
errorStatus: 0

0 comments on commit 19fdec0

Please sign in to comment.