Julie Laursen
07/18/2024, 10:36 PMMatt (pactflow.io / pact-js / pact-go)
Or is the goal that the provider verifies the pact file in the broker and doesn’t create it’s own pact json in a pact folder with interaction data?verification takes a pact file, and the Pact stands in for the consumer and executes test against the locally running provider. If it passes, the results are sent back to the broker (in a CI setup, you wouldn’t normally publish from local - but fine for your tests)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Julie Laursen
07/18/2024, 10:59 PMconst { Verifier } = require('@pact-foundation/pact')
const path = require('path')
let port
let opts
describe('Provider Tests', () => {
beforeAll(() => {
port = 4000
opts = {
provider: 'services',
consumer: 'company',
providerBaseUrl: `<http://localhost>:${port}`,
dir: path.resolve(process.cwd(), 'pacts')
}
})
it('tests the createCustomTask mutation', async () => {
await new Verifier(opts).verifyProvider()
})
})
And it seems like I should at least get past the 'file not found error' i'm seeing in CI before I worry about making the provider pact more complicatedJulie Laursen
07/18/2024, 11:00 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Slackbot
07/18/2024, 11:11 PMMatt (pactflow.io / pact-js / pact-go)
Julie Laursen
07/18/2024, 11:13 PMYousaf Nabi (pactflow.io)
pactUrls
is the option you should provide with a link to the consumer pact file you wish to verify (assuming it in on the same machine or you have copied the file to it)Julie Laursen
07/19/2024, 3:57 PM