npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

contract-tests

v1.0.0

Published

Contract Tests

Readme

Pact JS End-to-End Example

Using a simple animal dating API, we demonstrate the following Pact features:

This comprises a complete E2E example that can be used as a basis for projects.

The Example Project

[Matching API] -> [Profile API]+(DB)

Provider (Profile API)

Provides Animal profile information, including interests, zoo location and other personal details.

Consumer (Matching API)

Given an animal profile, recommends a suitable partner based on similar interests.

Running the tests

  1. npm install
  2. npm test:consumer - Run consumer tests
  3. npm test:publish - Publish contracts to the broker
  4. npm test:provider - Run provider tests

Running the API

If you want to experiment with the API to get an understanding:

  1. npm run api - Runs the both provider and consumer API

or individually :

  1. npm run provider - Runs the provider API (animal service)
  2. npm run consumer - Runs the consumer API (matching service)

Animal Profile API

The APIs are described below, including a bunch of cURL statements to invoke them. There is also a Postman Collection.

GET /animals

curl -X GET "http://localhost:8081/animals"

GET /animals/:id

curl -X GET "http://localhost:8081/animals/1"

GET /animals/available

curl -X GET http://localhost:8081/animals/available

POST /animals

curl -X POST -H "Content-Type: application/json" -d '{
  "first_name": "aoeu",
  "last_name": "aoeu",
  "age":  21,
  "gender": "M",
  "location": {
    "description": "Melbourne Zoo",
    "country": "Australia",
    "post_code": 3000
  },
  "eligibility": {
    "available": true,
    "previously_married": false
  },
  "interests": [
    "walks in the garden/meadow",
    "munching on a paddock bomb",
    "parkour"
  ]
}' "http://localhost:8081/animals"

Matching service

GET /suggestions/:id

curl -X GET http://localhost:8080/suggestions/1

Viewing contracts with the Pact Broker

A test Pact Boker is running at https://test.pact.dius.com.au:

  • Username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M
  • Password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1

Or use the API:

curl -v -u 'dXfltyFMgNOFZAxr8io9wJ37iUpY42M:O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1' https://test.pact.dius.com.au