@@ -5,24 +5,20 @@ import {
5
5
GatewayRuntime ,
6
6
useCustomFetch ,
7
7
} from '@graphql-hive/gateway-runtime' ;
8
- import { normalizedExecutor } from '@graphql-tools/executor' ;
9
8
import {
10
9
ExecutionResult ,
11
10
filterSchema ,
12
11
getDirective ,
13
12
MapperKind ,
14
13
mapSchema ,
15
14
} from '@graphql-tools/utils' ;
16
- import { assertSingleExecutionValue } from '@internal/testing' ;
17
15
import {
18
16
buildSchema ,
19
17
getNamedType ,
20
18
GraphQLSchema ,
21
19
isEnumType ,
22
20
lexicographicSortSchema ,
23
- parse ,
24
21
printSchema ,
25
- validate ,
26
22
} from 'graphql' ;
27
23
import { createRouter } from 'graphql-federation-gateway-audit' ;
28
24
import { beforeAll , describe , expect , it } from 'vitest' ;
@@ -154,84 +150,42 @@ describe('Federation Compatibility', () => {
154
150
) ;
155
151
} ) ;
156
152
tests . forEach ( ( _ , i ) => {
157
- describe ( `test-query-${ i } ` , ( ) => {
158
- // TODO: audit tests are not idempotent anymore, we need to restart the subgraphs
159
- // it('gives the correct result w/ core', async () => {
160
- // const test = tests[i];
161
- // if (!test) {
162
- // throw new Error(`Test ${i} not found`);
163
- // }
164
- // const document = parse(test.query, { noLocation: true });
165
- // const validationErrors = validate(stitchedSchema, document);
166
- // let result: ExecutionResult;
167
- // if (validationErrors.length > 0) {
168
- // result = {
169
- // errors: validationErrors,
170
- // };
171
- // } else {
172
- // const execRes = await normalizedExecutor({
173
- // schema: stitchedSchema,
174
- // document,
175
- // });
176
- // assertSingleExecutionValue(execRes);
177
- // result = execRes;
178
- // }
179
- // const received = {
180
- // data: result.data ?? null,
181
- // errors: !!result.errors?.length,
182
- // };
183
-
184
- // const expected = {
185
- // data: test.expected.data ?? null,
186
- // errors: test.expected.errors ?? false,
187
- // };
188
-
189
- // try {
190
- // expect(received).toEqual(expected);
191
- // } catch (e) {
192
- // result.errors?.forEach((err) => {
193
- // console.error(err);
194
- // });
195
- // throw e;
196
- // }
197
- // });
198
- it ( 'gives the correct result w/ gateway' , async ( ) => {
199
- const test = tests [ i ] ;
200
- if ( ! test ) {
201
- throw new Error ( `Test ${ i } not found` ) ;
202
- }
203
- const response = await gatewayRuntime . fetch (
204
- 'http://localhost/graphql' ,
205
- {
206
- method : 'POST' ,
207
- headers : {
208
- 'content-type' : 'application/json' ,
209
- } ,
210
- body : JSON . stringify ( {
211
- query : test . query ,
212
- } ) ,
153
+ it ( `test-query-${ i } ` , async ( ) => {
154
+ const test = tests [ i ] ;
155
+ if ( ! test ) {
156
+ throw new Error ( `Test ${ i } not found` ) ;
157
+ }
158
+ const response = await gatewayRuntime . fetch (
159
+ 'http://localhost/graphql' ,
160
+ {
161
+ method : 'POST' ,
162
+ headers : {
163
+ 'content-type' : 'application/json' ,
213
164
} ,
214
- ) ;
215
- const result : ExecutionResult = await response . json ( ) ;
216
- const received = {
217
- data : result . data ?? null ,
218
- errors : ! ! result . errors ?. length ,
219
- } ;
165
+ body : JSON . stringify ( {
166
+ query : test . query ,
167
+ } ) ,
168
+ } ,
169
+ ) ;
170
+ const result : ExecutionResult = await response . json ( ) ;
171
+ const received = {
172
+ data : result . data ?? null ,
173
+ errors : ! ! result . errors ?. length ,
174
+ } ;
220
175
221
- const expected = {
222
- data : test . expected . data ?? null ,
223
- errors : test . expected . errors ?? false ,
224
- } ;
176
+ const expected = {
177
+ data : test . expected . data ?? null ,
178
+ errors : test . expected . errors ?? false ,
179
+ } ;
225
180
226
- try {
227
- expect ( received ) . toEqual ( expected ) ;
228
- } catch ( e ) {
229
- result . errors ?. forEach ( ( err ) => {
230
- console . error ( err ) ;
231
- } ) ;
232
- throw e ;
233
- }
234
- } ) ;
181
+ try {
182
+ expect ( received ) . toEqual ( expected ) ;
183
+ } catch ( e ) {
184
+ result . errors ?. forEach ( ( err ) => {
185
+ console . error ( err ) ;
186
+ } ) ;
187
+ throw e ;
188
+ }
235
189
} ) ;
236
190
} ) ;
237
191
} ) ;
0 commit comments