]>
Commit | Line | Data |
---|---|---|
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 | "providerState": "there's forums", | |
12 | "request": { | |
13 | "method": "POST", | |
14 | "path": "/graphql", | |
15 | "headers": { | |
16 | "content-type": "application/json" | |
17 | }, | |
18 | "body": { | |
19 | "operationName": "GetForums", | |
20 | "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", | |
21 | "variables": { | |
22 | } | |
23 | }, | |
24 | "matchingRules": { | |
25 | "$.body.query": { | |
26 | "match": "regex", | |
27 | "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" | |
28 | } | |
29 | } | |
30 | }, | |
31 | "response": { | |
32 | "status": 200, | |
33 | "headers": { | |
34 | "Content-Type": "application/json; charset=utf-8" | |
35 | }, | |
36 | "body": { | |
37 | "data": { | |
38 | "forums": [ | |
39 | { | |
40 | "id": "butter", | |
41 | "glyph": "⌘", | |
42 | "label": "test_forums.butter", | |
43 | "position": 1 | |
44 | } | |
45 | ] | |
46 | } | |
47 | }, | |
48 | "matchingRules": { | |
49 | "$.body.data.forums": { | |
50 | "min": 1 | |
51 | }, | |
52 | "$.body.data.forums[*].*": { | |
53 | "match": "type" | |
54 | }, | |
55 | "$.body.data.forums[*].id": { | |
56 | "match": "type" | |
57 | }, | |
58 | "$.body.data.forums[*].glyph": { | |
59 | "match": "type" | |
60 | }, | |
61 | "$.body.data.forums[*].label": { | |
62 | "match": "type" | |
63 | }, | |
64 | "$.body.data.forums[*].position": { | |
65 | "match": "type" | |
66 | } | |
67 | } | |
68 | } | |
69 | }, | |
70 | { | |
71 | "description": "a request to get a single forum", | |
72 | "providerState": "there's forums", | |
73 | "request": { | |
74 | "method": "POST", | |
75 | "path": "/graphql", | |
76 | "headers": { | |
77 | "content-type": "application/json" | |
78 | }, | |
79 | "body": { | |
80 | "operationName": "GetForum", | |
81 | "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 }", | |
82 | "variables": { | |
83 | "id": "freezer" | |
84 | } | |
85 | }, | |
86 | "matchingRules": { | |
87 | "$.body.query": { | |
88 | "match": "regex", | |
89 | "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*\\}" | |
90 | } | |
91 | } | |
92 | }, | |
93 | "response": { | |
94 | "status": 200, | |
95 | "headers": { | |
96 | "Content-Type": "application/json; charset=utf-8" | |
97 | }, | |
98 | "body": { | |
99 | "data": { | |
100 | "forum": { | |
101 | "id": "freezer", | |
102 | "glyph": "✭", | |
103 | "label": "test_forums.freezer", | |
104 | "position": 3, | |
105 | "topics": [ | |
106 | { | |
107 | "id": "629de02c-151a-4db7-bb86-43b2add8a15a", | |
108 | "title": "Very pacty topic", | |
109 | "updated_at": 1619954611616, | |
110 | "ttl": 3601 | |
111 | } | |
112 | ] | |
113 | } | |
114 | } | |
115 | }, | |
116 | "matchingRules": { | |
117 | "$.body.data.forum": { | |
118 | "match": "type" | |
119 | }, | |
120 | "$.body.data.forum.glyph": { | |
121 | "match": "type" | |
122 | }, | |
123 | "$.body.data.forum.label": { | |
124 | "match": "type" | |
125 | }, | |
126 | "$.body.data.forum.position": { | |
127 | "match": "type" | |
128 | }, | |
129 | "$.body.data.forum.topics": { | |
130 | "min": 1 | |
131 | }, | |
132 | "$.body.data.forum.topics[*].*": { | |
133 | "match": "type" | |
134 | }, | |
135 | "$.body.data.forum.topics[*].id": { | |
136 | "match": "type" | |
137 | }, | |
138 | "$.body.data.forum.topics[*].title": { | |
139 | "match": "type" | |
140 | }, | |
141 | "$.body.data.forum.topics[*].updated_at": { | |
142 | "match": "type" | |
143 | }, | |
144 | "$.body.data.forum.topics[*].ttl": { | |
145 | "match": "type" | |
146 | } | |
147 | } | |
148 | } | |
149 | }, | |
150 | { | |
151 | "description": "a request to list the forums", | |
152 | "providerState": "there's no forums", | |
153 | "request": { | |
154 | "method": "POST", | |
155 | "path": "/graphql", | |
156 | "headers": { | |
157 | "content-type": "application/json" | |
158 | }, | |
159 | "body": { | |
160 | "operationName": "GetForums", | |
161 | "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", | |
162 | "variables": { | |
163 | } | |
164 | }, | |
165 | "matchingRules": { | |
166 | "$.body.query": { | |
167 | "match": "regex", | |
168 | "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" | |
169 | } | |
170 | } | |
171 | }, | |
172 | "response": { | |
173 | "status": 200, | |
174 | "headers": { | |
175 | "Content-Type": "application/json; charset=utf-8" | |
176 | }, | |
177 | "body": { | |
178 | "data": { | |
179 | "forums": [ | |
180 | ||
181 | ] | |
182 | } | |
183 | } | |
184 | } | |
185 | }, | |
186 | { | |
187 | "description": "a request to get a single forum", | |
188 | "providerState": "there's no forums", | |
189 | "request": { | |
190 | "method": "POST", | |
191 | "path": "/graphql", | |
192 | "headers": { | |
193 | "content-type": "application/json" | |
194 | }, | |
195 | "body": { | |
196 | "operationName": "GetForum", | |
197 | "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 }", | |
198 | "variables": { | |
199 | "id": "freezer" | |
200 | } | |
201 | }, | |
202 | "matchingRules": { | |
203 | "$.body.query": { | |
204 | "match": "regex", | |
205 | "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*\\}" | |
206 | } | |
207 | } | |
208 | }, | |
209 | "response": { | |
210 | "status": 200, | |
211 | "headers": { | |
212 | "Content-Type": "application/json; charset=utf-8" | |
213 | }, | |
214 | "body": { | |
215 | "data": { | |
216 | "forum": null | |
217 | } | |
218 | } | |
219 | } | |
220 | }, | |
221 | { | |
222 | "description": "a request to list the forums", | |
223 | "providerState": "there's an error", | |
224 | "request": { | |
225 | "method": "POST", | |
226 | "path": "/graphql", | |
227 | "headers": { | |
228 | "content-type": "application/json" | |
229 | }, | |
230 | "body": { | |
231 | "operationName": "GetForums", | |
232 | "query": "query GetForums {\n forums {\n id\n glyph\n label\n position\n __typename\n }\n }", | |
233 | "variables": { | |
234 | } | |
235 | }, | |
236 | "matchingRules": { | |
237 | "$.body.query": { | |
238 | "match": "regex", | |
239 | "regex": "query\\s*GetForums\\s*\\{\\s*forums\\s*\\{\\s*id\\s*glyph\\s*label\\s*position\\s*__typename\\s*\\}\\s*\\}" | |
240 | } | |
241 | } | |
242 | }, | |
243 | "response": { | |
244 | "status": 500, | |
245 | "headers": { | |
246 | } | |
247 | } | |
248 | }, | |
249 | { | |
250 | "description": "a request to get a single forum", | |
251 | "providerState": "there's an error", | |
252 | "request": { | |
253 | "method": "POST", | |
254 | "path": "/graphql", | |
255 | "headers": { | |
256 | "content-type": "application/json" | |
257 | }, | |
258 | "body": { | |
259 | "operationName": "GetForum", | |
260 | "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 }", | |
261 | "variables": { | |
262 | "id": "freezer" | |
263 | } | |
264 | }, | |
265 | "matchingRules": { | |
266 | "$.body.query": { | |
267 | "match": "regex", | |
268 | "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*\\}" | |
269 | } | |
270 | } | |
271 | }, | |
272 | "response": { | |
273 | "status": 500, | |
274 | "headers": { | |
275 | } | |
276 | } | |
277 | } | |
278 | ], | |
279 | "metadata": { | |
280 | "pactSpecification": { | |
281 | "version": "2.0.0" | |
282 | } | |
283 | } | |
284 | } |