]> git.r.bdr.sh - rbdr/forum/blob - pacts/forumclient-forumserver.json
b1c7fcbc06839cb8db9dd5471a613de33cab83a4
[rbdr/forum] / pacts / forumclient-forumserver.json
1 {
2 "consumer": {
3 "name": "ForumClient"
4 },
5 "provider": {
6 "name": "ForumServer"
7 },
8 "interactions": [
9 {
10 "description": "a request to get a single post",
11 "providerState": "there's data",
12 "request": {
13 "method": "POST",
14 "path": "/graphql",
15 "headers": {
16 "content-type": "application/json"
17 },
18 "body": {
19 "operationName": "GetPost",
20 "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 }",
21 "variables": {
22 "id": "freezer"
23 }
24 },
25 "matchingRules": {
26 "$.body.query": {
27 "match": "regex",
28 "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
29 }
30 }
31 },
32 "response": {
33 "status": 200,
34 "headers": {
35 "Content-Type": "application/json; charset=utf-8"
36 },
37 "body": {
38 "data": {
39 "post": {
40 "id": "8f75eba5-6989-4dd3-b466-e464546ce374",
41 "text": "This is a very pacty post",
42 "created_at": 1619976194937,
43 "author": {
44 "id": "a805b3de-cac4-451c-a1e6-f078869c9db9",
45 "handle": "pacts_person"
46 },
47 "topic": {
48 "id": "5c283ce1-0470-4b98-86f5-1fec9a22c9ac",
49 "title": "The parent pacts topic"
50 }
51 }
52 }
53 },
54 "matchingRules": {
55 "$.body.data.post": {
56 "match": "type"
57 },
58 "$.body.data.post.id": {
59 "match": "type"
60 },
61 "$.body.data.post.text": {
62 "match": "type"
63 },
64 "$.body.data.post.created_at": {
65 "match": "type"
66 },
67 "$.body.data.post.author": {
68 "match": "type"
69 },
70 "$.body.data.post.author.id": {
71 "match": "type"
72 },
73 "$.body.data.post.author.handle": {
74 "match": "type"
75 },
76 "$.body.data.post.topic": {
77 "match": "type"
78 },
79 "$.body.data.post.topic.id": {
80 "match": "type"
81 },
82 "$.body.data.post.topic.title": {
83 "match": "type"
84 }
85 }
86 }
87 },
88 {
89 "description": "a request to get a single post",
90 "providerState": "there's no data",
91 "request": {
92 "method": "POST",
93 "path": "/graphql",
94 "headers": {
95 "content-type": "application/json"
96 },
97 "body": {
98 "operationName": "GetPost",
99 "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 }",
100 "variables": {
101 "id": "freezer"
102 }
103 },
104 "matchingRules": {
105 "$.body.query": {
106 "match": "regex",
107 "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
108 }
109 }
110 },
111 "response": {
112 "status": 200,
113 "headers": {
114 "Content-Type": "application/json; charset=utf-8"
115 },
116 "body": {
117 "data": {
118 "post": null
119 }
120 }
121 }
122 },
123 {
124 "description": "a request to get a single post",
125 "providerState": "there's an error",
126 "request": {
127 "method": "POST",
128 "path": "/graphql",
129 "headers": {
130 "content-type": "application/json"
131 },
132 "body": {
133 "operationName": "GetPost",
134 "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 }",
135 "variables": {
136 "id": "freezer"
137 }
138 },
139 "matchingRules": {
140 "$.body.query": {
141 "match": "regex",
142 "regex": "query\\s*GetPost\\(\\$id:\\s*ID!\\)\\s*\\{\\s*post\\(id:\\s*\\$id\\)\\s*\\{\\s*id\\s*text\\s*created_at\\s*author\\s*\\{\\s*id\\s*handle\\s*__typename\\s*\\}\\s*topic\\s*\\{\\s*id\\s*title\\s*__typename\\s*\\}\\s*__typename\\s*\\}\\s*\\}"
143 }
144 }
145 },
146 "response": {
147 "status": 500,
148 "headers": {
149 }
150 }
151 },
152 {
153 "description": "a request to list the forums",
154 "providerState": "there's data",
155 "request": {
156 "method": "POST",
157 "path": "/graphql",
158 "headers": {
159 "content-type": "application/json"
160 },
161 "body": {
162 "operationName": "GetForums",
163 "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }",
164 "variables": {
165 }
166 },
167 "matchingRules": {
168 "$.body.query": {
169 "match": "regex",
170 "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
171 }
172 }
173 },
174 "response": {
175 "status": 200,
176 "headers": {
177 "Content-Type": "application/json; charset=utf-8"
178 },
179 "body": {
180 "data": {
181 "forums": [
182 {
183 "id": "butter",
184 "glyph": "⌘",
185 "label": "test_forums.butter",
186 "position": 1
187 }
188 ]
189 }
190 },
191 "matchingRules": {
192 "$.body.data.forums": {
193 "min": 1
194 },
195 "$.body.data.forums[*].*": {
196 "match": "type"
197 },
198 "$.body.data.forums[*].id": {
199 "match": "type"
200 },
201 "$.body.data.forums[*].glyph": {
202 "match": "type"
203 },
204 "$.body.data.forums[*].label": {
205 "match": "type"
206 },
207 "$.body.data.forums[*].position": {
208 "match": "type"
209 }
210 }
211 }
212 },
213 {
214 "description": "a request to get a single forum",
215 "providerState": "there's data",
216 "request": {
217 "method": "POST",
218 "path": "/graphql",
219 "headers": {
220 "content-type": "application/json"
221 },
222 "body": {
223 "operationName": "GetForum",
224 "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 }",
225 "variables": {
226 "id": "freezer"
227 }
228 },
229 "matchingRules": {
230 "$.body.query": {
231 "match": "regex",
232 "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*\\}"
233 }
234 }
235 },
236 "response": {
237 "status": 200,
238 "headers": {
239 "Content-Type": "application/json; charset=utf-8"
240 },
241 "body": {
242 "data": {
243 "forum": {
244 "id": "freezer",
245 "glyph": "✭",
246 "label": "test_forums.freezer",
247 "position": 3,
248 "topics": [
249 {
250 "id": "629de02c-151a-4db7-bb86-43b2add8a15a",
251 "title": "Very pacty topic",
252 "updated_at": 1619954611616,
253 "ttl": 3601
254 }
255 ]
256 }
257 }
258 },
259 "matchingRules": {
260 "$.body.data.forum": {
261 "match": "type"
262 },
263 "$.body.data.forum.glyph": {
264 "match": "type"
265 },
266 "$.body.data.forum.label": {
267 "match": "type"
268 },
269 "$.body.data.forum.position": {
270 "match": "type"
271 },
272 "$.body.data.forum.topics": {
273 "min": 1
274 },
275 "$.body.data.forum.topics[*].*": {
276 "match": "type"
277 },
278 "$.body.data.forum.topics[*].id": {
279 "match": "type"
280 },
281 "$.body.data.forum.topics[*].title": {
282 "match": "type"
283 },
284 "$.body.data.forum.topics[*].updated_at": {
285 "match": "type"
286 },
287 "$.body.data.forum.topics[*].ttl": {
288 "match": "type"
289 }
290 }
291 }
292 },
293 {
294 "description": "a request to list the forums",
295 "providerState": "there's no data",
296 "request": {
297 "method": "POST",
298 "path": "/graphql",
299 "headers": {
300 "content-type": "application/json"
301 },
302 "body": {
303 "operationName": "GetForums",
304 "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }",
305 "variables": {
306 }
307 },
308 "matchingRules": {
309 "$.body.query": {
310 "match": "regex",
311 "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
312 }
313 }
314 },
315 "response": {
316 "status": 200,
317 "headers": {
318 "Content-Type": "application/json; charset=utf-8"
319 },
320 "body": {
321 "data": {
322 "forums": [
323
324 ]
325 }
326 }
327 }
328 },
329 {
330 "description": "a request to get a single forum",
331 "providerState": "there's no data",
332 "request": {
333 "method": "POST",
334 "path": "/graphql",
335 "headers": {
336 "content-type": "application/json"
337 },
338 "body": {
339 "operationName": "GetForum",
340 "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 }",
341 "variables": {
342 "id": "freezer"
343 }
344 },
345 "matchingRules": {
346 "$.body.query": {
347 "match": "regex",
348 "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*\\}"
349 }
350 }
351 },
352 "response": {
353 "status": 200,
354 "headers": {
355 "Content-Type": "application/json; charset=utf-8"
356 },
357 "body": {
358 "data": {
359 "forum": null
360 }
361 }
362 }
363 },
364 {
365 "description": "a request to list the forums",
366 "providerState": "there's an error",
367 "request": {
368 "method": "POST",
369 "path": "/graphql",
370 "headers": {
371 "content-type": "application/json"
372 },
373 "body": {
374 "operationName": "GetForums",
375 "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }",
376 "variables": {
377 }
378 },
379 "matchingRules": {
380 "$.body.query": {
381 "match": "regex",
382 "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}"
383 }
384 }
385 },
386 "response": {
387 "status": 500,
388 "headers": {
389 }
390 }
391 },
392 {
393 "description": "a request to get a single forum",
394 "providerState": "there's an error",
395 "request": {
396 "method": "POST",
397 "path": "/graphql",
398 "headers": {
399 "content-type": "application/json"
400 },
401 "body": {
402 "operationName": "GetForum",
403 "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 }",
404 "variables": {
405 "id": "freezer"
406 }
407 },
408 "matchingRules": {
409 "$.body.query": {
410 "match": "regex",
411 "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*\\}"
412 }
413 }
414 },
415 "response": {
416 "status": 500,
417 "headers": {
418 }
419 }
420 }
421 ],
422 "metadata": {
423 "pactSpecification": {
424 "version": "2.0.0"
425 }
426 }
427 }