Skip to content

Commit caa2cd3

Browse files
committed
Test invalid onError is handled
1 parent 6a022b6 commit caa2cd3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/execution/__tests__/executor-test.ts

+30
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,36 @@ describe('Execute: Handles basic execution tasks', () => {
934934
});
935935
});
936936

937+
it('raises request error with invalid onError', () => {
938+
const schema = new GraphQLSchema({
939+
query: new GraphQLObjectType({
940+
name: 'query',
941+
fields: () => ({
942+
a: {
943+
type: GraphQLInt,
944+
resolve: () => ({}),
945+
},
946+
}),
947+
}),
948+
});
949+
950+
const document = parse('{ a }');
951+
const result = executeSync({
952+
schema,
953+
document,
954+
// @ts-expect-error
955+
onError: 'DANCE',
956+
});
957+
expectJSON(result).toDeepEqual({
958+
errors: [
959+
{
960+
message:
961+
'Unsupported `onError` value; supported values are `PROPAGATE`, `NO_PROPAGATE` and `ABORT`.',
962+
},
963+
],
964+
});
965+
});
966+
937967
it('uses the inline operation if no operation name is provided', () => {
938968
const schema = new GraphQLSchema({
939969
query: new GraphQLObjectType({

0 commit comments

Comments
 (0)