Skip to content

Commit

Permalink
test(deps): add v3 matching rules
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Oct 17, 2024
1 parent efd96e0 commit 68f1487
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/unit/product_service_pact_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,53 @@ async def test_receive_a_product_update(pact, handler, verifier):
.upon_receiving("a product event update", "Async")
.with_body(json.dumps(event),
"application/json")
.with_matching_rules(
{
"body": {
"$.event": {
"combine": "AND",
"matchers": [
{
"match": "regex",
"regex": "^(CREATED|UPDATED|DELETED)$"
}
]
},
"$.id": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.name": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.type": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.version": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
}
)
.with_metadata({"topic": "products"})
)
pact.verify(verifier, "Async")

0 comments on commit 68f1487

Please sign in to comment.