diff --git a/store.js b/store.js index 18066a4..fb521f7 100644 --- a/store.js +++ b/store.js @@ -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); }); diff --git a/test/store-test.js b/test/store-test.js index 1f5ead7..df3e933 100644 --- a/test/store-test.js +++ b/test/store-test.js @@ -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(); + });*/ +});