-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Term/array on query parameters generate invalid matching rules and expected value #1063
Comments
I think this is an allowed scenario.
Assuming this fixes it, we'll need to :
|
@mefellows thank you for a fast answer. Sorry, I didn't look whether it's already released 😞 Is there any suggested workaround to handle arrays right now? I've tried to use The only way that comes into my mind right now is to change tests to be parametrized and generate pacts for multiple array lengths |
I don't know of a workaround just yet, but if you're up for a PR that might help shortcut a resolution? |
Aside, but why are you trying to put matchers in the query parameter?
|
@TimothyJones I've explicitly passed there an exact value so the contract definition would generate, I know that the test does not make sense in any way. I'm using matchers in most of the cases to have generic endpoints in pact stub server, this way I do not have to take care of different array lengths (for e.g. to handle IDs from a
Yeah, I think that should be the way to go |
Ah right! Interesting use case |
Software versions
Please provide at least OS and version of pact-js
v19.7.0
Issue Checklist
Please confirm the following:
Expected behaviour
When running test like:
Should generate a matching rule like:
Actual behaviour
Running previous test generate pact with a rule on
$.ids[0]
and an example value for ids. This makesstub-server
not matching requests.Whether such case is not described in the docs, then using a
term
should be:Also an issue was already closed with some PRs being added pact-foundation/pact-reference#205 so I'm assuming that this should work already?
This also leads to wrongly generated
matchingRule
($.ids[0]
instead of$ids
)Steps to reproduce
Run the snipped above / replace
MatchersV3.eachLike
withMatchers.term({generate: 'id', matcher: '(.+)'})
Relevant log files
None
The text was updated successfully, but these errors were encountered: