Erich Buri
03/22/2023, 10:37 AM"combine": "AND", or "combine": "OR",
I'm interested in that feature, but I don't see how the I can apply it with pact-js. It always writes "combine": "AND",
How can I achieve an OR-Combination of Matchers?
The API I need to test provides Options of different types, and depending on the type, the type of the remaining fields change:
{
OPTION_A: {
"type": "Number",
"value": 0,
"allowedValues": [
0,
500,
1000,
2000
]
},
OPTION_B: {
"type": "String",
"value": "No",
"allowedValues": [
"Yes",
"No",
"Maybe"
]
}
}Erich Buri
03/23/2023, 11:38 AMMatt (pactflow.io / pact-js / pact-go)
Slackbot
03/23/2023, 12:21 PMErich Buri
03/23/2023, 4:03 PMMatt (pactflow.io / pact-js / pact-go)
A pact test is not about describing the possible responses, it’s about ensuring that your response types are covered.
For example, if you could say “it might be a person or a team”, you could pass your tests without ever checking that the provider and consumer agree about what a Team should look like
Think of the matchers as saying “this test covers all cases that pass this matcher”, not “this is the response schema”I think this should make it onto our “matchers” best practice guide
Timothy Jones
03/27/2023, 2:48 AMI think in this case the OR would actually make sense. I want to write a method for a pact-js test-case that would give me the general structure of the response and for each specific test-case I can then overwrite details.This doesn’t sound like a good fit for an or matcher to me. If you don’t care about certain parts of the response in your test, just don’t include them
Timothy Jones
03/27/2023, 2:49 AM