Repository
Current version released
2 years ago
Versions
Deno Pact
Pre-Reqs
You need to Download the Pact FFI Library for your platform
OS | Architecture | Supported |
---|---|---|
OSX | x86_64 | β |
OSX | arm | β |
Linux | x86_64 | β |
Linux | arm | β |
Windows | x86_64 | β |
deno run -A --unstable https://deno.land/x/pact/src/downloadFfi.ts --run
- Checks if it exists in
${HOME}/.pact/ffi/<pact_ffi_version>
- Downloads the necessary library for your architecture
- Executes the library to ensure it works
You can also do this in code
import { downloadFfiForPlatform } from "https://deno.land/x/pact/src/mod.ts";
await downloadFfiForPlatform()
How to use
import { DenoPact, Pact } from "https://deno.land/x/pact/src/mod.ts";
const denoPact = new DenoPact();
Examples
There is a handy helper script to run the examples
Try ./run help
for available commands or take a look at the run script
gRPC Area Calculator
- The Proto File - area_calculator.proto
- The Server - areaCalculatorServer.ts
- The Client - areaCalculator/areaCalculatorClient.ts
- The Client Pact test areaCalculatorClientTest.ts
- The Server Pact verification areaCalculatorProviderTest.ts
gRPC Greeter
- The Proto File - greeter.proto
- The Server - greeterServer.ts
- The Client - greeterClient.ts
- The Client Pact test greeterClientTest.ts
HTTP service - Swagger Mock Validator
- The Service - swaggerMockValidatorService.ts
- The Service Unit Test - swaggerMockValidatorService.test.ts
- The Server - swaggerMockValidatorServer.ts
- The Server Integration Test - swaggerMockValidatorServer.test.ts
- The Client Pact test swaggerMockValidatorServer.consumer.pact.ts
- The Server Pact verification swaggerMockValidatorServer.provider.pact.ts
Pact Verifications
- Pact verification task, tests multiple transport protocols verifier.test.ts
Docker
You can spin up various services with Docker to help you play around with the pact files generated, and the examples
- Pact Broker via Deno pactBroker.ts
- Pact Broker via Docker-Compose docker-compose.yml