Skip to content

Commit 68f1487

Browse files
committed
test(deps): add v3 matching rules
1 parent efd96e0 commit 68f1487

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/unit/product_service_pact_test.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,53 @@ async def test_receive_a_product_update(pact, handler, verifier):
6666
.upon_receiving("a product event update", "Async")
6767
.with_body(json.dumps(event),
6868
"application/json")
69+
.with_matching_rules(
70+
{
71+
"body": {
72+
"$.event": {
73+
"combine": "AND",
74+
"matchers": [
75+
{
76+
"match": "regex",
77+
"regex": "^(CREATED|UPDATED|DELETED)$"
78+
}
79+
]
80+
},
81+
"$.id": {
82+
"combine": "AND",
83+
"matchers": [
84+
{
85+
"match": "type"
86+
}
87+
]
88+
},
89+
"$.name": {
90+
"combine": "AND",
91+
"matchers": [
92+
{
93+
"match": "type"
94+
}
95+
]
96+
},
97+
"$.type": {
98+
"combine": "AND",
99+
"matchers": [
100+
{
101+
"match": "type"
102+
}
103+
]
104+
},
105+
"$.version": {
106+
"combine": "AND",
107+
"matchers": [
108+
{
109+
"match": "type"
110+
}
111+
]
112+
}
113+
}
114+
}
115+
)
69116
.with_metadata({"topic": "products"})
70117
)
71118
pact.verify(verifier, "Async")

0 commit comments

Comments
 (0)