Maxim Filimonov
08/16/2022, 7:59 AMV3Interaction compatible with ApolloGraphqlInteraction? I’m getting type errors:
Type 'ApolloGraphQLInteraction' is not assignable to type 'V3Interaction'.
Types of property 'uponReceiving' are incompatible.
Type '(description: string) => ApolloGraphQLInteraction' is not assignable to type 'string'.ts(2322)Maxim Filimonov
08/16/2022, 8:15 AMApolloGqlInteraciton to V3 interface but query there is a string while query in V3 is a record.
Hm…Matt (pactflow.io / pact-js / pact-go)
Maxim Filimonov
08/16/2022, 8:32 AMMaxim Filimonov
08/16/2022, 8:32 AMMaxim Filimonov
08/16/2022, 8:33 AMconst interaction = new ApolloGraphQLInteraction()
.uponReceiving(interactionDescription)
.withRequest({
path: '/graphql',
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
})
.withOperation(getOperationName(query))
.withQuery(printQueryToString(query))
.withVariables(variables)
.willRespondWith({
status: 200,
body: {
data: respondWith,
},
})
.json();
return {
states,
uponReceiving: interaction.description,
withRequest: {
method: interaction.request?.method,
path: interaction.request?.path,
query: {}, // this is not used on gql interactions
body: interaction.request?.body,
headers: interaction.request?.headers,
},
willRespondWith: {
status: interaction.response?.status,
body: interaction.response?.body,
headers: interaction.response?.headers,
},
};Maxim Filimonov
08/16/2022, 8:37 AMTimothy Jones
08/16/2022, 9:28 AMmethod: interaction.request?.method,
You might want to confirm whether the request is there and throw an error if it is not - otherwise users might get surprise results if they use the DSL incorrectly.