Skip to content

Commit

Permalink
printError: improve coverage (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 13, 2019
1 parent 3a71d3e commit 84b416f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/error/__tests__/printError-test.js
Expand Up @@ -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',
Expand Down

0 comments on commit 84b416f

Please sign in to comment.