From 84b416f855c11ae370b7a5f6f1e746ec22027a5f Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Thu, 13 Jun 2019 20:06:05 +0300 Subject: [PATCH] printError: improve coverage (#1982) --- src/error/__tests__/printError-test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/error/__tests__/printError-test.js b/src/error/__tests__/printError-test.js index 89cf3b7ca3..e5dd0af894 100644 --- a/src/error/__tests__/printError-test.js +++ b/src/error/__tests__/printError-test.js @@ -10,6 +10,21 @@ import { printError } from '../printError'; import { Kind, parse, Source } from '../../language'; describe('printError', () => { + it('prints an error without location', () => { + const error = new GraphQLError('Error without location'); + expect(printError(error)).to.equal('Error without location'); + }); + + it('prints an error using node without location', () => { + const error = new GraphQLError( + 'Error attached to node without location', + parse('{ foo }', { noLocation: true }), + ); + expect(printError(error)).to.equal( + 'Error attached to node without location', + ); + }); + it('prints an line numbers with correct padding', () => { const singleDigit = new GraphQLError( 'Single digit line number with no padding',