1 const path = require("path")
2 const chai = require("chai")
3 const chaiAsPromised = require("chai-as-promised")
4 const expect = chai.expect
5 const { PactV3, MatchersV3 } = require("@pact-foundation/pact/v3")
6 const { deleteFirstOrder } = require('../consumer')
8 chai.use(chaiAsPromised)
17 describe("Siren Pact test", () => {
21 provider = new PactV3({
22 consumer: "Siren Order Provider",
23 provider: "Siren Order Service",
25 dir: path.resolve(process.cwd(), "pacts")
29 it('deletes the first order using the delete action', () => {
31 .uponReceiving("get all orders")
38 'Content-Type': 'application/vnd.siren+json'
51 "href": url("http://localhost:9000", ["orders", regex("\\d+", "1234")])
58 "href": url("http://localhost:9000", ["orders", regex("\\d+", "1234")])
63 "href": url("http://localhost:9000", ["orders", regex("\\d+", "1234")])
70 href: url("http://localhost:9000", ["orders"])
75 .uponReceiving("delete order")
78 path: regex("/orders/\\d+", "/orders/1234"),
84 return provider.executeTest(mockserver => {
85 return expect(deleteFirstOrder(mockserver.url)).to.eventually.be.true