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