This file contains hidden or 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
require('dotenv').config(); | |
const publisher = require('@pact-foundation/pact-node'); | |
const path = require('path'); | |
if (process.env.PACT_LOCAL_BROKER) { | |
const opts = { | |
pactFilesOrDirs: [path.resolve(process.cwd(), 'pacts/')], | |
pactBroker: process.env.PACT_LOCAL_BROKER, | |
tags: ['test'], |
This file contains hidden or 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
"scripts": { | |
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js", | |
"publish:broker": "node ./__tests__/contract/broker/publish.js" | |
}, |
This file contains hidden or 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
"scripts": { | |
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js", | |
"publish:broker": "node ./__tests__/contract/broker/publish.js", | |
"publish:pactflow": "pact-broker publish ./pacts --consumer-app-version=1.0.0 --broker-base-url=PACTFLOW_URI --broker-token=PACTFLOW_TOKEN" | |
}, |
This file contains hidden or 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
{ | |
"characters": [ | |
{ | |
"id": 1, | |
"name": "Walter White", | |
"age": 58 | |
}, | |
{ | |
"id": 2, | |
"name": "Michael Scofield", |
This file contains hidden or 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
"scripts": { | |
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js", | |
"publish:broker": "node ./__tests__/contract/broker/publish.js", | |
"publish:pactflow": "pact-broker publish ./pacts --consumer-app-version=1.0.0 --broker-base-url=PACTFLOW_URI --broker-token=PACTFLOW_TOKEN", | |
"up:mock-service": "./node_modules/.bin/json-server ./data/characters.json -p 3378 -w" | |
}, |
This file contains hidden or 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 { Verifier } from '@pact-foundation/pact'; | |
const providerService = `http://localhost:3378`; | |
describe('Pact Verification', () => { | |
it('should validate the expectations of the consumer service', () => { | |
const brokerOpts = { | |
provider: 'characters-api-application', | |
providerBaseUrl: providerService, | |
pactUrls: [`http://localhost:9292/pacts/provider/characters-api-application/consumer/web-application/latest`], |
This file contains hidden or 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
"scripts": { | |
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js", | |
"publish:broker": "node ./__tests__/contract/broker/publish.js", | |
"publish:pactflow": "pact-broker publish ./pacts --consumer-app-version=1.0.0 --broker-base-url=PACTFLOW_URI --broker-token=PACTFLOW_TOKEN", | |
"up:mock-service": "./node_modules/.bin/json-server ./data/characters.json -p 3378 -w", | |
"test:provider-broker": "jest --runInBand __tests__/contract/provider/provider.spec.js --testTimeout=20000" | |
}, |
This file contains hidden or 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
"scripts": { | |
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js" | |
}, |
This file contains hidden or 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
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"jest": { | |
"testEnvironment": "node", | |
"transform": { | |
".(js|jsx|ts|tsx)": "@sucrase/jest-plugin" | |
} | |
}, |
This file contains hidden or 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
"scripts": { | |
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js", | |
"publish:broker": "node ./__tests__/contract/broker/publish.js", | |
"publish:pactflow": "pact-broker publish ./pacts --consumer-app-version=1.0.0 --broker-base-url=https://beyondtest.pact.dius.com.au/ --broker-token=l99xzrjHJeNUOO3MCacDDQ" | |
}, |