Hello Team, I am using Pact Matchers to match eith...
# pact-python
j
Hello Team, I am using Pact Matchers to match either integer or None but could not find any matcher to match 2 data types (int or Nonetype)
Copy code
.will_respond_with(
        status=200,
        body={
            "id": Like(1|None)
        }
)
@Matt (pactflow.io / pact-js / pact-go) is it possible to have Optional matches?
m
howtooptional
m
You need to create two test cases - one for when the value is present and another for when it is not
j
we are returning around 100 templates in an array, if there are certain fields which are not present in DB those are returned null but others have value. So we don’t have like 2 test cases, data comes with mix and match of null or values
m
if there are certain fields which are not present in DB those are returned null but others have value
https://docs.pact.io/provider#verify-your-pacts-against-a-locally-running-instance-of-the-provider This is why we have provider states - so that you can control these different states