33const assert = require ( 'node:assert' ) ;
44const { readFileSync } = require ( 'node:fs' ) ;
55
6- const {
7- experimentalExecuteIncrementally,
8- graphqlSync,
9- parse,
10- } = require ( 'graphql' ) ;
11- const { buildSchema } = require ( 'graphql/utilities' ) ;
6+ const { graphqlSync } = require ( 'graphql' ) ;
7+ const { astFromValue, buildSchema } = require ( 'graphql/utilities' ) ;
128const { version } = require ( 'graphql/version' ) ;
139
1410assert . deepStrictEqual (
@@ -18,7 +14,7 @@ assert.deepStrictEqual(
1814
1915const schema = buildSchema ( 'type Query { hello: String }' ) ;
2016
21- let result = graphqlSync ( {
17+ const result = graphqlSync ( {
2218 schema,
2319 source : '{ hello }' ,
2420 rootValue : { hello : 'world' } ,
@@ -32,25 +28,9 @@ assert.deepStrictEqual(result, {
3228} ) ;
3329
3430/**
35- * The below test triggers a call `invariant` method during execution (by
36- * passing a negative number to the `initialCount` parameter on the `@stream`
37- * directive). This ensures that the `inlineInvariant` method called by our
38- * build script works correctly.
31+ * The below test triggers a call to the `invariant` utility (by passing
32+ * an invalid value to astFromValue). This ensures that the
33+ * `inlineInvariant` function called by our build script works correctly.
3934 **/
4035
41- const experimentalSchema = buildSchema ( `
42- directive @stream(initialCount: Int!) on FIELD
43-
44- type Query {
45- greetings: [String]
46- }
47- ` ) ;
48-
49- result = experimentalExecuteIncrementally ( {
50- schema : experimentalSchema ,
51- document : parse ( '{ greetings @stream(initialCount: -1) }' ) ,
52- rootValue : { greetings : [ 'hi' , 'hello' ] } ,
53- } ) ;
54-
55- assert ( result . errors ?. [ 0 ] !== undefined ) ;
56- assert ( ! result . errors [ 0 ] . message . includes ( 'is not defined' ) ) ;
36+ assert . throws ( ( ) => astFromValue ( true , undefined ) , 'Unexpected input type: ' ) ;
0 commit comments