John Williams
05/31/2022, 9:55 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
John Williams
05/31/2022, 9:58 AMJohn Williams
05/31/2022, 10:00 AMMatt (pactflow.io / pact-js / pact-go)
John Williams
05/31/2022, 10:03 AMJohn Williams
05/31/2022, 10:05 AMMatt (pactflow.io / pact-js / pact-go)
John Williams
05/31/2022, 10:08 AMMatt (pactflow.io / pact-js / pact-go)
John Williams
05/31/2022, 10:08 AMMatt (pactflow.io / pact-js / pact-go)
John Williams
05/31/2022, 11:51 PMdescribe('API Test', () => {
const needToBeVerified = ['usernameCheck', 'signup']
each(needToBeVerified).it('should verify the expectations of %p Graphql', contractName => {
return new Verifier(createOptions(`apitest-${contractName}-provider`)).verifyProvider().then(output => {
if (output.includes('Diff')) {
console.log(output)
throw new Error(`${contractName} contract test error`)
}
})
})
})
On the provider side if the consumer test is making a query and if the data is not in the provider side database then this is no problem for pactMatt (pactflow.io / pact-js / pact-go)
So basically the provider test wont change the database state for mutations.When you run a provider test, you need to start up the provider (usually locally). If a consumer needs to perform a mutation, it will send the HTTP request (in this case a graphql query) to the target provider. It is up to you as the provider maintainer to decide if you stub databases or downstream systems, or let it through (highly recommend these are stubbed). See also https://docs.pact.io/provider#stub-calls-to-downstream-systems
Matt (pactflow.io / pact-js / pact-go)
John Williams
06/01/2022, 4:17 AMMatt (pactflow.io / pact-js / pact-go)