Skip to content

DiUS/pact-js-order-demo

Repository files navigation

Example JS project for the Pact workshop

Step 1: Run the consumer test

Demonstrates:

  • that we can put assumptions in our unit tests that aren't valid
  • Pact tests are nothing scary, and look much like the use of nock

Running step 1:

npm run test:consumer
npm run test:pact:consumer
npm run test:pact:publish

Step 2: Write the provider test

Demonstrates:

  • the assumptions in step 1 by the consumer team are wrong (failed test)
  • teams need to communicate with each other
  • use of flexible matching to make tests less brittle

Running step 2

npm run test:pact:consumer
npm run test:pact:publish
npm run test:pact:provider

Two problems

  1. qty -> quantity difference
  2. value -> itemValue

Step 3: fix provider test

Demonstrates:

  • fixes qty and itemValue properties in provider test
  • contract testing validates assumptions from both collaborators

Running step 3

npm run test:pact:consumer
npm run test:pact:publish
npm run test:pact:provider

Step 4: Broker / Can-i-deploy

Demonstrates:

  • sharing and collaborating on contracts via the Pact Broker
  • how you might integrate Pact into your CI and CD pipelines

Running step 4

npm run test:pact:consumer
npm run test:pact:publish
npm run test:pact:provider
npm run can-i-deploy:consumer
npm run can-i-deploy:provider

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •