Hi team, we trying to run verifier for our provider. However we want to break each interaction/state of the provider into separate test files. Currently, it looks like each test is overwriting the previous one, cause only the last test to verify one interaction.
m
Matt (pactflow.io / pact-js / pact-go)
06/15/2023, 9:52 PM
Yes, at the moment that’s the cases. You could split the state handlers across multiple tests, but not the individual interactions. What’s the aim Tony?
m
Moises Siles
06/16/2023, 3:50 AM
so, it’s possible to have multiple contracts, for instance, if my app has 3 modules (accounts, reports, contacts) can I have 1 contract per module? and multiple consumer/provider files? or in real life, it doesn’t work like that
m
Matt (pactflow.io / pact-js / pact-go)
06/16/2023, 7:51 AM
A contract is between a single consumer and a single provider. If the provider has 3 modules in it, that would usually be detail within the contract. You could model it that a provider is 3 applications, but it complicates your CI/CD pipeline and I wouldn’t advise it
Matt (pactflow.io / pact-js / pact-go)
06/16/2023, 7:51 AM
what are you trying to achieve by splitting it?
m
Moises Siles
06/16/2023, 3:40 PM
you are right, what I was thinking is that having a huge file with many tests can be hard to read or maintain. I’m still learning about contract tests, so that’s what I was asking about best practices