Den generierten Kontrakt für Vergleiche mit eingecheckt
authorKai Moritz <kai@juplo.de>
Sat, 21 May 2022 14:19:02 +0000 (16:19 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 21 May 2022 15:03:35 +0000 (17:03 +0200)
consumer/pacts/Siren Order Provider-Siren Order Service.json [new file with mode: 0644]

diff --git a/consumer/pacts/Siren Order Provider-Siren Order Service.json b/consumer/pacts/Siren Order Provider-Siren Order Service.json
new file mode 100644 (file)
index 0000000..138ef78
--- /dev/null
@@ -0,0 +1,256 @@
+{
+  "consumer": {
+    "name": "Siren Order Provider"
+  },
+  "interactions": [
+    {
+      "description": "get root",
+      "request": {
+        "method": "GET",
+        "path": "/"
+      },
+      "response": {
+        "body": {
+          "class": [
+            "representation"
+          ],
+          "links": [
+            {
+              "href": "http://localhost:8080/orders",
+              "rel": [
+                "orders"
+              ]
+            }
+          ]
+        },
+        "generators": {
+          "body": {
+            "$.links[0].href": {
+              "example": "http://localhost:8080/orders",
+              "regex": ".*(\\/orders)$",
+              "type": "MockServerURL"
+            }
+          }
+        },
+        "headers": {
+          "Content-Type": "application/vnd.siren+json"
+        },
+        "matchingRules": {
+          "body": {
+            "$.links[0].href": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "regex",
+                  "regex": ".*(\\/orders)$"
+                }
+              ]
+            }
+          },
+          "header": {}
+        },
+        "status": 200
+      }
+    },
+    {
+      "description": "get all orders",
+      "request": {
+        "method": "GET",
+        "path": "/orders"
+      },
+      "response": {
+        "body": {
+          "class": [
+            "entity"
+          ],
+          "entities": [
+            {
+              "actions": [
+                {
+                  "href": "http://localhost:8080/orders/1234",
+                  "method": "PUT",
+                  "name": "update"
+                },
+                {
+                  "href": "http://localhost:8080/orders/1234",
+                  "method": "DELETE",
+                  "name": "delete"
+                }
+              ],
+              "class": [
+                "entity"
+              ],
+              "links": [
+                {
+                  "href": "http://localhost:8080/orders/1234",
+                  "rel": [
+                    "self"
+                  ]
+                }
+              ],
+              "properties": {
+                "id": 1234
+              },
+              "rel": [
+                "item"
+              ]
+            }
+          ],
+          "links": [
+            {
+              "href": "http://localhost:8080/orders",
+              "rel": [
+                "self"
+              ]
+            }
+          ]
+        },
+        "generators": {
+          "body": {
+            "$.entities[*].links[0].href": {
+              "example": "http://localhost:8080/orders/1234",
+              "regex": ".*(\\/orders\\/\\d+)$",
+              "type": "MockServerURL"
+            },
+            "$.links[0].href": {
+              "example": "http://localhost:8080/orders",
+              "regex": ".*(\\/orders)$",
+              "type": "MockServerURL"
+            }
+          }
+        },
+        "headers": {
+          "Content-Type": "application/vnd.siren+json"
+        },
+        "matchingRules": {
+          "body": {
+            "$.entities": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            },
+            "$.entities[*].actions": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "arrayContains",
+                  "variants": [
+                    {
+                      "generators": {
+                        "$.href": {
+                          "example": "http://localhost:8080/orders/1234",
+                          "regex": ".*(\\/orders\\/\\d+)$",
+                          "type": "MockServerURL"
+                        }
+                      },
+                      "index": 0,
+                      "rules": {
+                        "$.href": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "regex",
+                              "regex": ".*(\\/orders\\/\\d+)$"
+                            }
+                          ]
+                        }
+                      }
+                    },
+                    {
+                      "generators": {
+                        "$.href": {
+                          "example": "http://localhost:8080/orders/1234",
+                          "regex": ".*(\\/orders\\/\\d+)$",
+                          "type": "MockServerURL"
+                        }
+                      },
+                      "index": 1,
+                      "rules": {
+                        "$.href": {
+                          "combine": "AND",
+                          "matchers": [
+                            {
+                              "match": "regex",
+                              "regex": ".*(\\/orders\\/\\d+)$"
+                            }
+                          ]
+                        }
+                      }
+                    }
+                  ]
+                }
+              ]
+            },
+            "$.entities[*].links[0].href": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "regex",
+                  "regex": ".*(\\/orders\\/\\d+)$"
+                }
+              ]
+            },
+            "$.entities[*].properties.id": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "integer"
+                }
+              ]
+            },
+            "$.links[0].href": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "regex",
+                  "regex": ".*(\\/orders)$"
+                }
+              ]
+            }
+          },
+          "header": {}
+        },
+        "status": 200
+      }
+    },
+    {
+      "description": "delete order",
+      "request": {
+        "matchingRules": {
+          "path": {
+            "combine": "AND",
+            "matchers": [
+              {
+                "match": "regex",
+                "regex": "/orders/\\d+"
+              }
+            ]
+          }
+        },
+        "method": "DELETE",
+        "path": "/orders/1234"
+      },
+      "response": {
+        "status": 200
+      }
+    }
+  ],
+  "metadata": {
+    "pact-js": {
+      "version": "10.0.0-beta.59"
+    },
+    "pactRust": {
+      "ffi": "0.2.4",
+      "models": "0.3.1"
+    },
+    "pactSpecification": {
+      "version": "3.0.0"
+    }
+  },
+  "provider": {
+    "name": "Siren Order Service"
+  }
+}
\ No newline at end of file