]>
Commit | Line | Data |
---|---|---|
73973eda RBR |
1 | { |
2 | "consumer": { | |
3 | "name": "ForumsStore" | |
4 | }, | |
5 | "provider": { | |
6 | "name": "ForumAPIServer" | |
7 | }, | |
8 | "interactions": [ | |
9 | { | |
10 | "description": "a request to list the forums", | |
11 | "request": { | |
12 | "method": "POST", | |
13 | "path": "/graphql", | |
14 | "headers": { | |
15 | "content-type": "application/json" | |
16 | }, | |
17 | "body": { | |
18 | "operationName": "GetForums", | |
19 | "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", | |
20 | "variables": { | |
21 | } | |
22 | }, | |
23 | "matchingRules": { | |
24 | "$.body.query": { | |
25 | "match": "regex", | |
26 | "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" | |
27 | } | |
28 | } | |
29 | }, | |
30 | "response": { | |
31 | "status": 200, | |
32 | "headers": { | |
33 | "Content-Type": "application/json; charset=utf-8" | |
34 | }, | |
35 | "body": { | |
36 | "data": { | |
37 | "forums": [ | |
38 | { | |
39 | "id": "butter", | |
40 | "glyph": "⌘", | |
41 | "label": "test_forums.butter", | |
42 | "position": 1 | |
43 | } | |
44 | ] | |
45 | } | |
46 | }, | |
47 | "matchingRules": { | |
48 | "$.body.data.forums": { | |
49 | "min": 1 | |
50 | }, | |
51 | "$.body.data.forums[*].*": { | |
52 | "match": "type" | |
53 | }, | |
54 | "$.body.data.forums[*].id": { | |
55 | "match": "type" | |
56 | }, | |
57 | "$.body.data.forums[*].glyph": { | |
58 | "match": "type" | |
59 | }, | |
60 | "$.body.data.forums[*].label": { | |
61 | "match": "type" | |
62 | }, | |
63 | "$.body.data.forums[*].position": { | |
64 | "match": "type" | |
65 | } | |
66 | } | |
67 | } | |
fcbbc496 RBR |
68 | }, |
69 | { | |
70 | "description": "a request to get a single forum", | |
71 | "request": { | |
72 | "method": "POST", | |
73 | "path": "/graphql", | |
74 | "headers": { | |
75 | "content-type": "application/json" | |
76 | }, | |
77 | "body": { | |
78 | "operationName": "GetForum", | |
79 | "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 }", | |
80 | "variables": { | |
81 | "id": "freezer" | |
82 | } | |
83 | }, | |
84 | "matchingRules": { | |
85 | "$.body.query": { | |
86 | "match": "regex", | |
87 | "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*\\}" | |
88 | } | |
89 | } | |
90 | }, | |
91 | "response": { | |
92 | "status": 200, | |
93 | "headers": { | |
94 | "Content-Type": "application/json; charset=utf-8" | |
95 | }, | |
96 | "body": { | |
97 | "data": { | |
98 | "forum": { | |
99 | "id": "freezer", | |
100 | "glyph": "✭", | |
101 | "label": "test_forums.freezer", | |
102 | "position": 3, | |
103 | "topics": [ | |
104 | { | |
105 | "id": "629de02c-151a-4db7-bb86-43b2add8a15a", | |
106 | "title": "Very pacty topic", | |
107 | "updated_at": 1619954611616, | |
108 | "ttl": 3601 | |
109 | } | |
110 | ] | |
111 | } | |
112 | } | |
113 | }, | |
114 | "matchingRules": { | |
115 | "$.body.data.forum": { | |
116 | "match": "type" | |
117 | }, | |
118 | "$.body.data.forum.glyph": { | |
119 | "match": "type" | |
120 | }, | |
121 | "$.body.data.forum.label": { | |
122 | "match": "type" | |
123 | }, | |
124 | "$.body.data.forum.position": { | |
125 | "match": "type" | |
126 | }, | |
127 | "$.body.data.forum.topics": { | |
128 | "min": 1 | |
129 | }, | |
130 | "$.body.data.forum.topics[*].*": { | |
131 | "match": "type" | |
132 | }, | |
133 | "$.body.data.forum.topics[*].id": { | |
134 | "match": "type" | |
135 | }, | |
136 | "$.body.data.forum.topics[*].title": { | |
137 | "match": "type" | |
138 | }, | |
139 | "$.body.data.forum.topics[*].updated_at": { | |
140 | "match": "type" | |
141 | }, | |
142 | "$.body.data.forum.topics[*].ttl": { | |
143 | "match": "type" | |
144 | } | |
145 | } | |
146 | } | |
73973eda RBR |
147 | } |
148 | ], | |
149 | "metadata": { | |
150 | "pactSpecification": { | |
151 | "version": "2.0.0" | |
152 | } | |
153 | } | |
154 | } |