Skip to content

Commit

Permalink
Add tests for custom serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Coquereau committed Jul 22, 2015
1 parent f90d0ad commit d893256
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 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,26 @@ test("queryRecord - returning sideloaded data loads the data", function() {
}));
});

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

ajaxResponse({
post: { _ID_: 1, _NAME_: "Rails is omakase" }
});

store.queryRecord('post', { slug: 'rails-is-omakaze' }).then(async(function(post) {

deepEqual(
post.getProperties('id', 'name'),
{ id: "1", name: "Rails is omakase" },
"Post 1 is loaded with correct data"
);
}));
});

test("findMany - findMany uses a correct URL to access the records", function() {
Post.reopen({ comments: DS.hasMany('comment', { async: true }) });
adapter.coalesceFindRequests = true;
Expand Down

0 comments on commit d893256

Please sign in to comment.