Open ptornhult opened 7 years ago
Perhaps, in the interests of maintaining backwards compatibility for the jvm impl, we could print an obnoxious warning when a 0 length array is specified?
For the Rust impl, I'm pretty keen on not allowing 0 length.
I prefer this to be an error, in the same way as giving an example value that does not match the regex causes an error.
I'd prefer an error too, I just wasn't sure if you'd be cool with making it backwards incompatible.
If the eachLike matcher specifies Zero items the service provider implementing the Pact might only specify an empty array which would pass all tests. Once deployed, your provider could return an item that doesn't look like the one you expected, and then you have a bug (which you may or may not notice).
Right now the JVM version and JS version of eachLike behave differently in this regard. They should behave the same I would think/hope. It was a good catch by @bethesque to not allow this to slip into the JS version of Pact, but it should be fixed in the JVM version then. I can make a PR for this if you like?
Read the comments here for more info: https://github.com/pact-foundation/pact-js/pull/95