@@ -4035,39 +4035,40 @@ it('calls enabled fn after context building', async () => {
40354035it ( 'id field in body is returned as is and not overwritten' , async ( ) => {
40364036 expect . assertions ( 1 ) ;
40374037 const queryResult = {
4038- 'id' : "idString" , 'header' : { 'id' : { 'fieldA' : 'Tick' , 'fieldB' : 'Trick' , 'fieldC' : 'Track' } , 'someField' : 'someData' }
4039- }
4038+ id : 'idString' ,
4039+ header : { id : { fieldA : 'Tick' , fieldB : 'Trick' , fieldC : 'Track' } , someField : 'someData' } ,
4040+ } ;
40404041 const schema = makeExecutableSchema ( {
40414042 typeDefs : /* GraphQL */ `
40424043 type Query {
40434044 subgraphObject: SubgraphObject
4044- },
4045+ }
40454046 type SubgraphObject {
4046- id: String,
4047- header: Header,
4048- },
4047+ id: String
4048+ header: Header
4049+ }
40494050 type Header {
4050- id: IdObject,
4051+ id: IdObject
40514052 someField: String
4052- },
4053+ }
40534054 type IdObject {
4054- fieldA: String,
4055- fieldB: String,
4056- fieldC: String,
4055+ fieldA: String
4056+ fieldB: String
4057+ fieldC: String
40574058 }
40584059 ` ,
40594060 resolvers : { Query : { subgraphObject : ( ) => queryResult } } ,
40604061 } ) ;
40614062 const testkit = createTestkit (
4062- [
4063- useEngine ( { ...GraphQLJS , execute : normalizedExecutor , subscribe : normalizedExecutor } ) ,
4064- useResponseCache ( {
4065- session : ( ) => null ,
4066- ttl :0 ,
4067- ignoreIdFieldsBySchemaCoordinate :[ 'Header.id' ]
4068- } ) ,
4069- ] ,
4070- schema ,
4063+ [
4064+ useEngine ( { ...GraphQLJS , execute : normalizedExecutor , subscribe : normalizedExecutor } ) ,
4065+ useResponseCache ( {
4066+ session : ( ) => null ,
4067+ ttl : 0 ,
4068+ ignoreIdFieldsBySchemaCoordinate : [ 'Header.id' ] ,
4069+ } ) ,
4070+ ] ,
4071+ schema ,
40714072 ) ;
40724073
40734074 const document = /* GraphQL */ `
@@ -4098,42 +4099,44 @@ it('id field in body is returned as is and not overwritten', async () => {
40984099it ( 'id field in body overwritten and request fails' , async ( ) => {
40994100 expect . assertions ( 1 ) ;
41004101 const queryResult = {
4101- 'id' : "idString" , 'header' : { 'id' : { 'fieldA' : 'Tick' , 'fieldB' : 'Trick' , 'fieldC' : 'Track' } , 'someField' : 'someData' }
4102- }
4102+ id : 'idString' ,
4103+ header : { id : { fieldA : 'Tick' , fieldB : 'Trick' , fieldC : 'Track' } , someField : 'someData' } ,
4104+ } ;
41034105 const schema = makeExecutableSchema ( {
41044106 typeDefs : /* GraphQL */ `
41054107 type Query {
41064108 subgraphObject: SubgraphObject
4107- },
4109+ }
41084110 type SubgraphObject {
4109- id: String,
4110- header: Header!,
4111- },
4111+ id: String
4112+ header: Header!
4113+ }
41124114 type Header {
4113- id: IdObject!,
4115+ id: IdObject!
41144116 someField: String
4115- },
4117+ }
41164118 type IdObject {
4117- fieldA: String!,
4118- fieldB: String!,
4119- fieldC: String!,
4119+ fieldA: String!
4120+ fieldB: String!
4121+ fieldC: String!
41204122 }
41214123 ` ,
41224124 resolvers : { Query : { subgraphObject : ( ) => queryResult } } ,
41234125 } ) ;
41244126 const testkit = createTestkit (
4125- [
4126- useEngine ( { ...GraphQLJS , execute : normalizedExecutor , subscribe : normalizedExecutor } ) ,
4127- useResponseCache ( {
4128- enabled ( context : any ) : boolean {
4129- return true ;
4130- } , session ( context : any ) : string | undefined | null {
4131- return "sessionString" ;
4132- } ,
4133- ttl :0
4134- } ) ,
4135- ] ,
4136- schema ,
4127+ [
4128+ useEngine ( { ...GraphQLJS , execute : normalizedExecutor , subscribe : normalizedExecutor } ) ,
4129+ useResponseCache ( {
4130+ enabled ( context : any ) : boolean {
4131+ return true ;
4132+ } ,
4133+ session ( context : any ) : string | undefined | null {
4134+ return 'sessionString' ;
4135+ } ,
4136+ ttl : 0 ,
4137+ } ) ,
4138+ ] ,
4139+ schema ,
41374140 ) ;
41384141
41394142 const document = /* GraphQL */ `
@@ -4152,6 +4155,5 @@ it('id field in body overwritten and request fails', async () => {
41524155 }
41534156 ` ;
41544157
4155- await expect ( testkit . execute ( document ) ) . rejects . toThrow ( TypeError ) ;
4156-
4157- } ) ;
4158+ await expect ( testkit . execute ( document ) ) . rejects . toThrow ( TypeError ) ;
4159+ } ) ;
0 commit comments