Skip to content

Commit

Permalink
Add test for when an array is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Coquereau committed Jul 22, 2015
1 parent d893256 commit 6d6a955
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/ember-data/tests/integration/adapter/rest-adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,19 @@ test("queryRecord - returning sideloaded data loads the data", function() {
}));
});

test("queryRecord - returning an array picks the first one but saves all records to the store", function() {
ajaxResponse({
post: [{ id: 1, name: "Rails is omakase" }, { id: 2, name: "Ember is js" }]
});

store.queryRecord('post', { slug: 'rails-is-omakaze' }).then(async(function(post) {
var post2 = store.peekRecord('post', 2);

deepEqual(post.getProperties('id', 'name'), { id: "1", name: "Rails is omakase" });
deepEqual(post2.getProperties('id', 'name'), { id: "2", name: "Ember is js" });
}));
});

test("queryRecord - data is normalized through custom serializers", function() {
env.registry.register('serializer:post', DS.RESTSerializer.extend({
primaryKey: '_ID_',
Expand Down

0 comments on commit 6d6a955

Please sign in to comment.