feat: URLs are now injected by the mock server
authorRonald Holshausen <rholshausen@dius.com.au>
Tue, 5 Jan 2021 04:45:55 +0000 (15:45 +1100)
committerRonald Holshausen <rholshausen@dius.com.au>
Tue, 5 Jan 2021 04:45:55 +0000 (15:45 +1100)
consumer/package.json
consumer/src/__tests__/delete-order.spec.js

index 03d024a..0741577 100644 (file)
@@ -9,7 +9,7 @@
   "author": "",
   "license": "MIT",
   "devDependencies": {
-    "@pact-foundation/pact": "^10.0.0-beta.19",
+    "@pact-foundation/pact": "^10.0.0-beta.23",
     "chai": "^4.2.0",
     "chai-as-promised": "^7.1.1",
     "jest": "^26.4.2"
index 988f84a..88498b9 100644 (file)
@@ -22,7 +22,6 @@ describe("Siren Pact test", () => {
     provider = new PactV3({
       consumer: "Siren Order Provider",
       provider: "Siren Order Service",
-      port: 9000,
       dir: path.resolve(process.cwd(), "pacts")
     })
   })
@@ -41,8 +40,8 @@ describe("Siren Pact test", () => {
           'Content-Type': 'application/vnd.siren+json'
         },
         body: {
-          class:[ "representation"],
-          links:[{"rel":["orders"], "href":  url("http://localhost:9000", ["orders"]) }]
+          class: [ "representation"],
+          links: [{"rel":["orders"], "href":  url(["orders"]) }]
         }
       })
 
@@ -67,26 +66,26 @@ describe("Siren Pact test", () => {
             links: [
               {
                 "rel": [ "self" ],
-                "href": url("http://localhost:9000", ["orders", regex("\\d+", "1234")])
+                "href": url(["orders", regex("\\d+", "1234")])
               }
             ],
             "actions": arrayContaining(
               {
                 "name": "update",
                 "method": "PUT",
-                "href": url("http://localhost:9000", ["orders", regex("\\d+", "1234")])
+                "href": url(["orders", regex("\\d+", "1234")])
               },
               {
                 "name": "delete",
                 "method": "DELETE",
-                "href": url("http://localhost:9000", ["orders", regex("\\d+", "1234")])
+                "href": url(["orders", regex("\\d+", "1234")])
               }
             )
           }),
           links: [
             {
               rel: [ "self" ],
-              href: url("http://localhost:9000", ["orders"])
+              href: url(["orders"])
             }
           ]
         }