Git Product home page Git Product logo

pact-demo's Introduction

Pact Demo

An example repo that shows a consumer of an api and the provider of that API being integrated with a locally hosted Pact Broker.

Step 1: Run the Pact Broker

Step 2: Run the consumer tests (publishing the pact contract)

Step 3: Run the provider tests (verifying the provider)

Step 4: Take a look at the pact broker

You can modify the provider and increment the provider version get a demo of the Pact Matrix

The same example is available in Typescript and Node JS. Just pick whichever you prefer!

Consumer

The consumer is written to look similar to an AWS Lambda function. When invoked it will make an external API request to the Demo Provider API.

To run the unit tests for the consumer, from the consumer directory run:

  • npm run test:unit

To run the pact contract tests for the consumer, from the consumer directory run:

  • npm run test:contract

Provider

The provider is a demo express app that is configured to run locally on port 8080. It has a single endpoint that provides some arbitrary data that the consumer is expecting to be there.

the provider can be validated against the consumer defined contract by running the provider contract tests; From the Provider directory run:

  • npm run test:contract

Pact Broker

A docker compose file is included that will let you spin up an instance of the the pact broker.

you can start this by running docker-compose up from the Pact Broker directory. By default the broker will be running on localhost:9292

from the pact broker you can see what contracts the consumer has published for its providers and what versions of providers have validated against those contracts

Pacts

Pacts

Pact Matrix

Pact Matrix

pact-demo's People

Contributors

adamslack avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.