Skip to content

Commit

Permalink
Add failing test for normalizeErrors introduced in PR #2392
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Bourassa committed May 29, 2015
1 parent 5d7c15f commit 005a244
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1356,3 +1356,29 @@ test("serializing relationships with an embedded and without calls super when no
ok(calledSerializeBelongsTo);
ok(calledSerializeHasMany);
});

test('extractErrors extracts embedded errors', function() {
env.registry.register('serializer:super-villain', DS.ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
evilMinions: { embedded: 'always' }
}
}));

var serializer = env.container.lookup('serializer:super-villain');
var payload = {
errors: {
evil_minions: [
{ name: ['required'] }
]
}
};

serializer.extractErrors(env.store, SuperVillain, payload, null); // id (last param) is not relevant here
deepEqual(payload, {
errors: {
evilMinions: [
{ name: ['required'] }
]
}
});
});

0 comments on commit 005a244

Please sign in to comment.