From bb128feef7e787f90934ed72c9d61b95d8b90503 Mon Sep 17 00:00:00 2001 From: Hafiz Ismail Date: Wed, 1 Jun 2016 22:19:32 +0800 Subject: [PATCH] Fix test assertions for validation test when using custom TypeInfo - 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. --- src/validation/__tests__/validation-test.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/validation/__tests__/validation-test.js b/src/validation/__tests__/validation-test.js index 2a280257f8..412bfd99ec 100644 --- a/src/validation/__tests__/validation-test.js +++ b/src/validation/__tests__/validation-test.js @@ -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"?' ]); });