Skip to content

Commit

Permalink
respond with all data in create
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed May 22, 2018
1 parent 3d1ed11 commit 499b73e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
4 changes: 1 addition & 3 deletions store.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ canReflect.assignMap(Store.prototype,{
req.data[idProp] = ++this.maxId;

this.connection.createData( typeConvert.call(this,req.data) ).then(function(data){
var responseData = {};
responseData[idProp] = req.data[idProp];
res(responseData);
res(data);
}, function(err){
res(403, err);
});
Expand Down
37 changes: 37 additions & 0 deletions test/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,40 @@ QUnit.test("anything with a schema will be converted to a queryLogic automatical


});


QUnit.test("createData, destroyData, updateData", function(assert){
var store = fixture.store([
{id: 0, name: "foo"}
], new QueryLogic({identity: ["id"]}));

QUnit.stop();
store.createData({
data: {name: "bar"}
}, function(instance){
QUnit.deepEqual(instance, {id: 1, name: "bar"} );
QUnit.start();
});
/*
.then(function(instance){
var data = store.getList({});
assert.deepEqual(data, {
count: 2,
data: [
{id: 0, name: "foo"},
{id: 1, name: "updated"}
]
});
return store.destroyInstance(instance);
})
.then(function(){
var data = store.getList({});
assert.deepEqual(data, {
count: 1,
data: [
{id: 0, name: "foo"}
]
});
QUnit.start();
});*/
});

0 comments on commit 499b73e

Please sign in to comment.