Hi folks, What's a canonical way to test a new enu...
# protobufs
s
Hi folks, What's a canonical way to test a new enum value being introduced? Like if we have enum fields A,B and C, and newer version of a proto lib used by both provider and the consumer introduces D value. Consumer updates, provider doesn't update at first, but then does it too. How do we test this in Pact? Our team is currently using
equalTo
on every possible option, so the consumer will introduce new test which would use
equalTo('D')
in the request and just assert no error received in the response. This means we have a separate test for each possible enum value though. Is it a good way to do things or is there a better way?
cc @Matt (pactflow.io / pact-js / pact-go) for visibility, and for (I hope) an interesting use case đŸ˜„
Friendly ping on this question
m
ah, sorry I missed this Stan. Yeh, this is one of those awkward situations about how far to go. If it’s on the request body, the provider test would likely pass (as it would ignore the value before it’s aware of the type change). I think it’s reasonable to add a test for each case though so you’re explicit about it. If it were on the response, then the test would presumably fail verification so that’s a bit more straightforward.