Created
July 26, 2019 13:37
-
-
Save q-ode/cb147823f33b302a168f3fa77bdc8479 to your computer and use it in GitHub Desktop.
Sample Provider verification using Jest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pact from '@pact-foundation/pact-node/src/pact'; | |
describe('Provider', () => { | |
it('satisfies all Contracts', async () => { | |
const provider = process.env.CIRCLE_PROJECT_REPONAME; | |
const pactBroker = process.env.PACT_BROKER; | |
const pactBrokerToken = process.env.PACT_BROKER_TOKEN; | |
const gitBranch = process.env.CIRCLE_BRANCH; | |
const gitCommitHash = process.env.CIRCLE_SHA1; | |
const providerBaseUrl = 'http://localhost:80'; | |
await expect( | |
pact.verifyPacts({ | |
provider, | |
providerBaseUrl, | |
pactBrokerToken, | |
pactBrokerUrl: pactBroker, | |
publishVerificationResult: gitBranch === 'master', // only publish verification results for master | |
providerVersion: gitCommitHash, | |
tags: ['master'], | |
}) | |
).resolves.not.toThrow(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment