Skip to content

Commit

Permalink
Fix test assertions for validation test when using custom TypeInfo
Browse files Browse the repository at this point in the history
- Test should had broke for changes in #355 which improved
  validation messages with suggestions.
- But `expect().to.deep.equal()` checks for the right number of errors
  but does not check for equality of error messages.
  • Loading branch information
sogko committed Jun 1, 2016
1 parent 359ec76 commit bb128fe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/validation/__tests__/validation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ describe('Validate: Supports full validation', () => {
specifiedRules
);

expect(errors).to.deep.equal([
new Error('Cannot query field "catOrDog" on type "QueryRoot".'),
new Error('Cannot query field "furColor" on type "Cat".'),
new Error('Cannot query field "isHousetrained" on type "Dog".'),
const errorMessages = errors.map(err => err.message);

expect(errorMessages).to.deep.equal([
'Cannot query field "catOrDog" on type "QueryRoot". ' +
'Did you mean "catOrDog"?',
'Cannot query field "furColor" on type "Cat". ' +
'Did you mean "furColor"?',
'Cannot query field "isHousetrained" on type "Dog". ' +
'Did you mean "isHousetrained"?'
]);
});

Expand Down

0 comments on commit bb128fe

Please sign in to comment.