Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 6277d52

Browse files
committed
http-test: simplify a bit
1 parent 4140325 commit 6277d52

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/__tests__/http-test.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ import multer from 'multer';
1313
import { expect } from 'chai';
1414
import { describe, it } from 'mocha';
1515
import {
16-
buildSchema,
17-
GraphQLSchema,
18-
GraphQLObjectType,
19-
GraphQLNonNull,
20-
GraphQLString,
21-
GraphQLError,
22-
ValidationContext,
23-
BREAK,
16+
type ASTVisitor,
17+
type ValidationContext,
2418
Source,
25-
validate,
26-
execute,
19+
GraphQLError,
20+
GraphQLString,
21+
GraphQLNonNull,
22+
GraphQLObjectType,
23+
GraphQLSchema,
2724
parse,
28-
type ASTVisitor,
25+
execute,
26+
validate,
27+
buildSchema,
2928
} from 'graphql';
3029

3130
import { graphqlHTTP } from '../index';
@@ -1939,9 +1938,7 @@ function runTests(server) {
19391938
customValidateFn(schema, documentAST, validationRules) {
19401939
const errors = validate(schema, documentAST, validationRules);
19411940

1942-
const error = new GraphQLError(`custom error ${errors.length}`);
1943-
1944-
return [error];
1941+
return [new GraphQLError(`custom error ${errors.length}`)];
19451942
},
19461943
}),
19471944
);
@@ -1968,11 +1965,10 @@ function runTests(server) {
19681965
context: ValidationContext,
19691966
): ASTVisitor {
19701967
return {
1971-
enter() {
1968+
Document() {
19721969
context.reportError(
19731970
new GraphQLError('AlwaysInvalidRule was really invalid!'),
19741971
);
1975-
return BREAK;
19761972
},
19771973
};
19781974
};

0 commit comments

Comments
 (0)