Skip to content

Commit 84b416f

Browse files
printError: improve coverage (#1982)
1 parent 3a71d3e commit 84b416f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/error/__tests__/printError-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ import { printError } from '../printError';
1010
import { Kind, parse, Source } from '../../language';
1111

1212
describe('printError', () => {
13+
it('prints an error without location', () => {
14+
const error = new GraphQLError('Error without location');
15+
expect(printError(error)).to.equal('Error without location');
16+
});
17+
18+
it('prints an error using node without location', () => {
19+
const error = new GraphQLError(
20+
'Error attached to node without location',
21+
parse('{ foo }', { noLocation: true }),
22+
);
23+
expect(printError(error)).to.equal(
24+
'Error attached to node without location',
25+
);
26+
});
27+
1328
it('prints an line numbers with correct padding', () => {
1429
const singleDigit = new GraphQLError(
1530
'Single digit line number with no padding',

0 commit comments

Comments
 (0)