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 11, 2015
1 parent 4b44728 commit 2154a63
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,21 @@ test("extractErrors camelizes keys", function() {
firstName: ["firstName not evil enough"]
});
});

test('extractErrors extracts polymorphic records errors', function() {
var payload = {
errors: {
evil_minions: [
{ name: ['required'] }
]
}
};

var serializer = env.container.lookup('serializer:application');
// note: id (last param) is not relevant here
var extractedErrors = serializer.extractErrors(env.store, MediocreVillain, payload, null);

deepEqual(extractedErrors, {
evilMinions: [{ name: ['required'] }]
});
});

0 comments on commit 2154a63

Please sign in to comment.