]> git.r.bdr.sh - rbdr/forum/blobdiff - pacts/forumsstore-forumapiserver.json
Add error/empty cases for forums
[rbdr/forum] / pacts / forumsstore-forumapiserver.json
index c3d2c0d66a6ed63f321d2e0e1b9e1f07c5356c80..c0e784bd26965e4f00d101a26590f711be397acd 100644 (file)
@@ -8,6 +8,7 @@
   "interactions": [
     {
       "description": "a request to list the forums",
+      "providerState": "there's forums",
       "request": {
         "method": "POST",
         "path": "/graphql",
@@ -16,7 +17,7 @@
         },
         "body": {
           "operationName": "GetForums",
-          "query": "query GetForums {\n            forums {\n              id\n              glyph\n              label\n              position\n              __typename\n            }\n          }",
+          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
           "variables": {
           }
         },
@@ -68,6 +69,7 @@
     },
     {
       "description": "a request to get a single forum",
+      "providerState": "there's forums",
       "request": {
         "method": "POST",
         "path": "/graphql",
@@ -76,7 +78,7 @@
         },
         "body": {
           "operationName": "GetForum",
-          "query": "query GetForum($id: ID!) {\n            forum(id: $id) {\n              id\n              glyph\n              label\n              position\n              topics {\n                id\n                title\n                updated_at\n                ttl\n                __typename\n              }\n              __typename\n            }\n          }",
+          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
           "variables": {
             "id": "freezer"
           }
           }
         }
       }
+    },
+    {
+      "description": "a request to list the forums",
+      "providerState": "there's no forums",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetForums",
+          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
+          "variables": {
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
+          }
+        }
+      },
+      "response": {
+        "status": 200,
+        "headers": {
+          "Content-Type": "application/json; charset=utf-8"
+        },
+        "body": {
+          "data": {
+            "forums": [
+
+            ]
+          }
+        }
+      }
+    },
+    {
+      "description": "a request to get a single forum",
+      "providerState": "there's no forums",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetForum",
+          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+          "variables": {
+            "id": "freezer"
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+          }
+        }
+      },
+      "response": {
+        "status": 200,
+        "headers": {
+          "Content-Type": "application/json; charset=utf-8"
+        },
+        "body": {
+          "data": {
+            "forum": null
+          }
+        }
+      }
+    },
+    {
+      "description": "a request to list the forums",
+      "providerState": "there's an error",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetForums",
+          "query": "query GetForums {\n              forums {\n                id\n                glyph\n                label\n                position\n                __typename\n              }\n            }",
+          "variables": {
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
+          }
+        }
+      },
+      "response": {
+        "status": 500,
+        "headers": {
+        }
+      }
+    },
+    {
+      "description": "a request to get a single forum",
+      "providerState": "there's an error",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetForum",
+          "query": "query GetForum($id: ID!) {\n              forum(id: $id) {\n                id\n                glyph\n                label\n                position\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+          "variables": {
+            "id": "freezer"
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetForum\\(\\$id:\\s*ID!\\)\\s*\\{\\s*forum\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+          }
+        }
+      },
+      "response": {
+        "status": 500,
+        "headers": {
+        }
+      }
     }
   ],
   "metadata": {