Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

hmcts/pact-sample-consumer-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pact consumer sample with nodeJS

You can use git tags to follow the implementation steps:

git tag -n

step-1   Generate Pact contract
step-2   Use pact contract to run a stub server
step-3   Publish the contract on a broker

Generate Pact contracts

You may use a provider (mock server) and add create some tests hitting this server to make sure your codebase is compliant with your expected provider interactions.

$ yarn test:pact

Publish Pact contracts

You can start a local broker server using the following command:

$ yarn broker # To stop the broker use `yarn broker:stop`

Then trigger the publication of the contract:

$ yarn test:pact:publish

The broker UI is visible on http://localhost

Use Pact contracts to run a stub server

Using the previously generated pact you can run your application with a server responding as per the contract.

$ yarn mock

# In another session
$ yarn start