Open SunriseOYR opened 2 years ago
Well with the example you have provided that is expected behaviour. Could you please share an example of what you expect that's not working?
Are you saying that you want to match exact values?
Well with the example you have provided that is expected behaviour. Could you please share an example of what you expect that's not working?
Are you saying that you want to match exact values?
Yes, I want to match exact values, The match is only successful when marketCode
= RU
Any update on this, I found the same issue and I am using version 4.4.3. The "stringValue" field is not being checked on the value, just on the type.
Does eachLike
support checking the value when defined in the example?
return new PactDslJsonBody()
.eachLike("fruits")
.stringType("id", "example-id")
.stringType("name", "example-name")
.stringType("description", "test description")
.stringValue("type", "gala")
.stringType("color", "test-color")
.stringType("grade", "test-grade")
.closeArray();
}
@kevinmavely eachLike
sets up type matching on all the fields
I had also issue with newJsonArrayMinLike
. This is when min=0.
Probably they are related: https://github.com/pact-foundation/pact-specification/issues/108
As per the previous comment, the eachLike
set of functions setup type matching on all fields. If you want to override it with a particular value, use equalTo
instead of stringValue
.
I just want to make test failed, when array contain invalid element, but tests still passes.
If I call newJsonArrayMinLike(1, ...)
, everything works as expected. But in some cases newJsonArrayMinLike(0, ...)
is needed, and this result in passing tests on invalid response bodies.
(Not sure if this this is the same issue as the thread started with)
versions
DslPart
json
But now, as long as
marketCode
is astring
, validation will be successful, I testedstringType
andstringMatcher
and they work fine, whilestringValue
andnumberValue
don't work