]> git.r.bdr.sh - rbdr/forum/blobdiff - pacts/forumclient-forumserver.json
Add tags store pact tests
[rbdr/forum] / pacts / forumclient-forumserver.json
index b1c7fcbc06839cb8db9dd5471a613de33cab83a4..3933bccffb7a932fd69599e6f8a0ba9edf00854d 100644 (file)
@@ -19,7 +19,7 @@
           "operationName": "GetPost",
           "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
           "variables": {
-            "id": "freezer"
+            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
           }
         },
         "matchingRules": {
@@ -98,7 +98,7 @@
           "operationName": "GetPost",
           "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
           "variables": {
-            "id": "freezer"
+            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
           }
         },
         "matchingRules": {
           "operationName": "GetPost",
           "query": "query GetPost($id: ID!) {\n              post(id: $id) {\n                id\n                text\n                created_at\n                author {\n                  id\n                  handle\n                  __typename\n                }\n                topic {\n                  id\n                  title\n                  __typename\n                }\n                __typename\n              }\n            }",
           "variables": {
-            "id": "freezer"
+            "id": "8f75eba5-6989-4dd3-b466-e464546ce374"
           }
         },
         "matchingRules": {
         "headers": {
         }
       }
+    },
+    {
+      "description": "a request to get a single tag",
+      "providerState": "there's data",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetTag",
+          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+          "variables": {
+            "id": "pineapple"
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\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": {
+            "tag": {
+              "id": "pineapple",
+              "topics": [
+                {
+                  "id": "cd038ae7-e8b4-4e38-9543-3d697e69ac34",
+                  "title": "This topic is about pineapples",
+                  "updated_at": 1619978944077,
+                  "ttl": 3555
+                }
+              ]
+            }
+          }
+        },
+        "matchingRules": {
+          "$.body.data.tag.id": {
+            "match": "type"
+          },
+          "$.body.data.tag.topics": {
+            "min": 1
+          },
+          "$.body.data.tag.topics[*].*": {
+            "match": "type"
+          },
+          "$.body.data.tag.topics[*].id": {
+            "match": "type"
+          },
+          "$.body.data.tag.topics[*].title": {
+            "match": "type"
+          },
+          "$.body.data.tag.topics[*].updated_at": {
+            "match": "type"
+          },
+          "$.body.data.tag.topics[*].ttl": {
+            "match": "type"
+          }
+        }
+      }
+    },
+    {
+      "description": "a request to get a single tag",
+      "providerState": "there's no data",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetTag",
+          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+          "variables": {
+            "id": "pineapple"
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\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": {
+            "tag": null
+          }
+        }
+      }
+    },
+    {
+      "description": "a request to get a single tag",
+      "providerState": "there's an error",
+      "request": {
+        "method": "POST",
+        "path": "/graphql",
+        "headers": {
+          "content-type": "application/json"
+        },
+        "body": {
+          "operationName": "GetTag",
+          "query": "query GetTag($id: ID!) {\n              tag(id: $id) {\n                id\n                topics {\n                  id\n                  title\n                  updated_at\n                  ttl\n                  __typename\n                }\n                __typename\n              }\n            }",
+          "variables": {
+            "id": "pineapple"
+          }
+        },
+        "matchingRules": {
+          "$.body.query": {
+            "match": "regex",
+            "regex": "query\\s*GetTag\\(\\$id:\\s*ID!\\)\\s*\\{\\s*tag\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*topics\\s*\\{\\s*id\\s*title\\s*updated_at\\s*ttl\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
+          }
+        }
+      },
+      "response": {
+        "status": 500,
+        "headers": {
+        }
+      }
     }
   ],
   "metadata": {