]> juplo.de Git - demos/kafka/chat/commitdiff
feat: Refined pact between `UserService` and `ChatBackendController`
authorKai Moritz <kai@juplo.de>
Mon, 13 Oct 2025 19:07:06 +0000 (21:07 +0200)
committerKai Moritz <kai@juplo.de>
Mon, 13 Oct 2025 19:07:13 +0000 (21:07 +0200)
* Added expectations, how an existing `User` can be fetched

UserService-ChatBackendController.json

index d9be1e704e442dd6c5396372848c114221408f04..f1bd48801248d2d7d6bf886f9d8c1137130f4e93 100644 (file)
@@ -3,6 +3,105 @@
     "name": "UserService"
   },
   "interactions": [
+    {
+      "description": "a request for /user/5c73531c-6fc4-426c-adcb-afc5c140a0f7",
+      "pending": false,
+      "providerStates": [
+        {
+          "name": "there are 10 shards"
+        },
+        {
+          "name": "the server is responsible for shard 2"
+        },
+        {
+          "name": "user 5c73531c-6fc4-426c-adcb-afc5c140a0f7 exists in shard 2"
+        }
+      ],
+      "request": {
+        "headers": {
+          "Accept": [
+            "application/json"
+          ]
+        },
+        "matchingRules": {
+          "header": {
+            "Accept": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            }
+          }
+        },
+        "method": "GET",
+        "path": "/user/5c73531c-6fc4-426c-adcb-afc5c140a0f7"
+      },
+      "response": {
+        "body": {
+          "content": {
+            "id": "5c73531c-6fc4-426c-adcb-afc5c140a0f7",
+            "shard": 2
+          },
+          "contentType": "application/json",
+          "encoded": false
+        },
+        "headers": {
+          "Content-Type": [
+            "application/json"
+          ]
+        },
+        "status": 200
+      },
+      "type": "Synchronous/HTTP"
+    },
+    {
+      "description": "a request to calculate the shard for a given id",
+      "pending": false,
+      "providerStates": [
+        {
+          "name": "there are 10 shards"
+        }
+      ],
+      "request": {
+        "headers": {
+          "Accept": [
+            "application/json"
+          ]
+        },
+        "matchingRules": {
+          "header": {
+            "Accept": {
+              "combine": "AND",
+              "matchers": [
+                {
+                  "match": "type"
+                }
+              ]
+            }
+          }
+        },
+        "method": "GET",
+        "path": "/shard/5c73531c-6fc4-426c-adcb-afc5c140a0f7"
+      },
+      "response": {
+        "body": {
+          "content": {
+            "shard": 2
+          },
+          "contentType": "application/json",
+          "encoded": false
+        },
+        "headers": {
+          "Content-Type": [
+            "application/json"
+          ]
+        },
+        "status": 200
+      },
+      "type": "Synchronous/HTTP"
+    },
     {
       "description": "a request to create a user",
       "pending": false,
     }
   ],
   "metadata": {
-    "pact-js": {
-      "version": "16.0.0"
-    },
     "pactRust": {
       "ffi": "0.4.28",
       "models": "1.3.5"