Skip to content

Commit 0231740

Browse files
committed
refactor test with hardcoded expected
1 parent e6789ef commit 0231740

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/execution/__tests__/executor-test.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { GraphQLSchema } from '../../type/schema';
2424

2525
import { execute, executeSync } from '../execute';
2626

27-
describe('Execute: Handles basic execution tasks', () => {
27+
describe.only('Execute: Handles basic execution tasks', () => {
2828
it('throws if no document is provided', () => {
2929
const schema = new GraphQLSchema({
3030
query: new GraphQLObjectType({
@@ -1376,12 +1376,19 @@ describe('Execute: Handles basic execution tasks', () => {
13761376

13771377
// Returns at least 2 errors, one for the first 'wrongArg', and one for coercion limit
13781378
expect(result.errors).to.have.lengthOf(options.maxCoercionErrors + 1);
1379-
expect(
1380-
result.errors && result.errors.length > 0
1381-
? result.errors[result.errors.length - 1].message
1382-
: undefined,
1383-
).to.equal(
1384-
'Too many errors processing variables, error limit reached. Execution aborted.',
1385-
);
1379+
1380+
expectJSON(result).toDeepEqual({
1381+
errors: [
1382+
{
1383+
message:
1384+
'Variable "$data" got invalid value { email: "", wrongArg: "wrong", wrongArg2: "wrong", wrongArg3: "wrong" }; Field "wrongArg" is not defined by type "User".',
1385+
locations: [{ line: 2, column: 17 }],
1386+
},
1387+
{
1388+
message:
1389+
'Too many errors processing variables, error limit reached. Execution aborted.',
1390+
},
1391+
],
1392+
});
13861393
});
13871394
});

0 commit comments

Comments
 (0)