@@ -22,6 +22,7 @@ import {
2222 SetupTest ,
2323} from './test-util.js' ;
2424
25+ const schemaDefinition = `schema {\n query: Query\n}\n\n`
2526let dbname = '' ;
2627
2728vi . mock ( '../src/core/clickhouse/index.js' , ( ) => {
@@ -1037,7 +1038,7 @@ describe('Contract tests', () => {
10371038 namespace : DEFAULT_NAMESPACE ,
10381039 } ) ;
10391040 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1040- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {
1041+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {
10411042 hello: String!
10421043}` ) ;
10431044
@@ -1052,10 +1053,7 @@ describe('Contract tests', () => {
10521053 namespace : DEFAULT_NAMESPACE ,
10531054 } ) ;
10541055 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1055- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {
1056- hello: String!
1057- hi: String!
1058- }` ) ;
1056+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {\n hello: String!\n hi: String!\n}` ) ;
10591057
10601058 await server . close ( ) ;
10611059 } ) ;
@@ -1095,7 +1093,7 @@ describe('Contract tests', () => {
10951093 namespace : DEFAULT_NAMESPACE ,
10961094 } ) ;
10971095 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1098- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {\n hi: String!\n}` ) ;
1096+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {\n hi: String!\n}` ) ;
10991097
11001098 await client . publishFederatedSubgraph ( {
11011099 name : subgraphName ,
@@ -1108,7 +1106,7 @@ describe('Contract tests', () => {
11081106 namespace : DEFAULT_NAMESPACE ,
11091107 } ) ;
11101108 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1111- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {\n hi: String!\n}` ) ;
1109+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {\n hi: String!\n}` ) ;
11121110
11131111 await server . close ( ) ;
11141112 } ) ;
@@ -1158,7 +1156,7 @@ describe('Contract tests', () => {
11581156 namespace : DEFAULT_NAMESPACE ,
11591157 } ) ;
11601158 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1161- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {
1159+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {
11621160 hello: String!
11631161 test: String!
11641162}` ) ;
@@ -1173,7 +1171,7 @@ describe('Contract tests', () => {
11731171 namespace : DEFAULT_NAMESPACE ,
11741172 } ) ;
11751173 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1176- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {
1174+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {
11771175 hello: String!
11781176}` ) ;
11791177
@@ -1225,7 +1223,7 @@ describe('Contract tests', () => {
12251223 namespace : DEFAULT_NAMESPACE ,
12261224 } ) ;
12271225 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1228- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {\n hi: String!\n}` ) ;
1226+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {\n hi: String!\n}` ) ;
12291227
12301228 await client . deleteFederatedSubgraph ( {
12311229 subgraphName : subgraph2Name ,
@@ -1237,7 +1235,7 @@ describe('Contract tests', () => {
12371235 namespace : DEFAULT_NAMESPACE ,
12381236 } ) ;
12391237 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1240- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {\n hi: String!\n}` ) ;
1238+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {\n hi: String!\n}` ) ;
12411239
12421240 await server . close ( ) ;
12431241 } ) ;
@@ -1291,7 +1289,7 @@ describe('Contract tests', () => {
12911289 namespace : DEFAULT_NAMESPACE ,
12921290 } ) ;
12931291 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1294- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {
1292+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {
12951293 hello: String!
12961294 test: String!
12971295}` ) ;
@@ -1307,7 +1305,7 @@ describe('Contract tests', () => {
13071305 namespace : DEFAULT_NAMESPACE ,
13081306 } ) ;
13091307 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1310- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {
1308+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {
13111309 hello: String!
13121310}` ) ;
13131311
@@ -1351,7 +1349,7 @@ describe('Contract tests', () => {
13511349 namespace : DEFAULT_NAMESPACE ,
13521350 } ) ;
13531351 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1354- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {
1352+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {
13551353 hello: String!
13561354 test: String!
13571355}` ) ;
@@ -1368,7 +1366,7 @@ describe('Contract tests', () => {
13681366 namespace : DEFAULT_NAMESPACE ,
13691367 } ) ;
13701368 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1371- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {
1369+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {
13721370 hello: String!
13731371}` ) ;
13741372
@@ -1431,7 +1429,7 @@ describe('Contract tests', () => {
14311429 namespace : DEFAULT_NAMESPACE ,
14321430 } ) ;
14331431 expect ( sdlResponse . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1434- expect ( sdlResponse . clientSchema ) . toEqual ( `type Query {
1432+ expect ( sdlResponse . clientSchema ) . toEqual ( schemaDefinition + `type Query {
14351433 hello: String!
14361434 test: String!
14371435}` ) ;
@@ -1448,9 +1446,7 @@ describe('Contract tests', () => {
14481446 namespace : DEFAULT_NAMESPACE ,
14491447 } ) ;
14501448 expect ( sdlResponse2 . response ?. code ) . toEqual ( EnumStatusCode . OK ) ;
1451- expect ( sdlResponse2 . clientSchema ) . toEqual ( `type Query {
1452- hello: String!
1453- }` ) ;
1449+ expect ( sdlResponse2 . clientSchema ) . toEqual ( schemaDefinition + `type Query {\n hello: String!\n}` ) ;
14541450
14551451 await server . close ( ) ;
14561452 } ) ;
@@ -1737,6 +1733,11 @@ describe('Contract tests', () => {
17371733 ) ;
17381734 expect ( normalizeString ( executionConfig . engineConfig ! . graphqlClientSchema ! ) ) . toBe (
17391735 normalizeString ( `
1736+ schema {
1737+ query: Query
1738+ mutation: Mutation
1739+ }
1740+
17401741 type Query {
17411742 user(id: ID!): User!
17421743 product(sku: ID!): User!
@@ -1792,6 +1793,7 @@ describe('Contract tests', () => {
17921793 query: Query
17931794 mutation: Mutation
17941795 }
1796+
17951797 directive @tag(name: String!) repeatable on ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION
17961798 directive @inaccessible on ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION
17971799
@@ -1836,6 +1838,11 @@ describe('Contract tests', () => {
18361838 ) ;
18371839 expect ( normalizeString ( newExecutionConfig . engineConfig ! . graphqlClientSchema ! ) ) . toBe (
18381840 normalizeString ( `
1841+ schema {
1842+ query: Query
1843+ mutation: Mutation
1844+ }
1845+
18391846 type Query {
18401847 user(id: ID!): User!
18411848 product(sku: ID!): User!
@@ -1988,6 +1995,11 @@ describe('Contract tests', () => {
19881995 ) ;
19891996 expect ( normalizeString ( executionConfig . engineConfig ! . graphqlClientSchema ! ) ) . toBe (
19901997 normalizeString ( `
1998+ schema {
1999+ query: Query
2000+ mutation: Mutation
2001+ }
2002+
19912003 type Query {
19922004 internalUser(id: ID!): InternalUser!
19932005 internalProduct(sku: ID!): InternalProduct!
@@ -2041,6 +2053,7 @@ describe('Contract tests', () => {
20412053 query: Query
20422054 mutation: Mutation
20432055 }
2056+
20442057 directive @authenticated on ENUM | FIELD_DEFINITION | INTERFACE | OBJECT | SCALAR
20452058 directive @inaccessible on ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | FIELD_DEFINITION | INPUT_FIELD_DEFINITION | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION
20462059 directive @requiresScopes(scopes: [[openfed__Scope!]!]!) on ENUM | FIELD_DEFINITION | INTERFACE | OBJECT | SCALAR
@@ -2088,6 +2101,11 @@ describe('Contract tests', () => {
20882101 ) ;
20892102 expect ( normalizeString ( newExecutionConfig . engineConfig ! . graphqlClientSchema ! ) ) . toBe (
20902103 normalizeString ( `
2104+ schema {
2105+ query: Query
2106+ mutation: Mutation
2107+ }
2108+
20912109 type Query {
20922110 internalUser(id: ID!): InternalUser!
20932111 internalProduct(sku: ID!): InternalProduct!
0 commit comments