From 73973edab9aaa81312ba80a68bfe34bf5abcecd9 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sun, 2 May 2021 00:23:16 +0200 Subject: Add pact test for forums store --- pacts/forumsstore-forumapiserver.json | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 pacts/forumsstore-forumapiserver.json (limited to 'pacts') diff --git a/pacts/forumsstore-forumapiserver.json b/pacts/forumsstore-forumapiserver.json new file mode 100644 index 0000000..26a2810 --- /dev/null +++ b/pacts/forumsstore-forumapiserver.json @@ -0,0 +1,75 @@ +{ + "consumer": { + "name": "ForumsStore" + }, + "provider": { + "name": "ForumAPIServer" + }, + "interactions": [ + { + "description": "a request to list the 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": [ + { + "id": "butter", + "glyph": "⌘", + "label": "test_forums.butter", + "position": 1 + } + ] + } + }, + "matchingRules": { + "$.body.data.forums": { + "min": 1 + }, + "$.body.data.forums[*].*": { + "match": "type" + }, + "$.body.data.forums[*].id": { + "match": "type" + }, + "$.body.data.forums[*].glyph": { + "match": "type" + }, + "$.body.data.forums[*].label": { + "match": "type" + }, + "$.body.data.forums[*].position": { + "match": "type" + } + } + } + } + ], + "metadata": { + "pactSpecification": { + "version": "2.0.0" + } + } +} \ No newline at end of file -- cgit