File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -69,4 +69,38 @@ describe('perform', () => {
69
69
i ++ ;
70
70
}
71
71
} ) ;
72
+
73
+ it ( 'should include parsing errors in result' , async ( ) => {
74
+ const getEnveloped = envelop ( { ...graphqlFuncs , plugins : [ useSchema ( schema ) ] } ) ;
75
+
76
+ const { perform } = getEnveloped ( ) ;
77
+
78
+ const result = await perform ( { query : '{' } ) ;
79
+ assertSingleExecutionValue ( result ) ;
80
+
81
+ expect ( result ) . toMatchInlineSnapshot ( `
82
+ Object {
83
+ "errors": Array [
84
+ [GraphQLError: Syntax Error: Expected Name, found <EOF>.],
85
+ ],
86
+ }
87
+ ` ) ;
88
+ } ) ;
89
+
90
+ it ( 'should include validation errors in result' , async ( ) => {
91
+ const getEnveloped = envelop ( { ...graphqlFuncs , plugins : [ useSchema ( schema ) ] } ) ;
92
+
93
+ const { perform } = getEnveloped ( ) ;
94
+
95
+ const result = await perform ( { query : '{ idontexist }' } ) ;
96
+ assertSingleExecutionValue ( result ) ;
97
+
98
+ expect ( result ) . toMatchInlineSnapshot ( `
99
+ Object {
100
+ "errors": Array [
101
+ [GraphQLError: Cannot query field "idontexist" on type "Query".],
102
+ ],
103
+ }
104
+ ` ) ;
105
+ } ) ;
72
106
} ) ;
You can’t perform that action at this time.
0 commit comments