The state parameters can be passed, like at pact 3 specification
https://github.com/pact-foundation/pact-specification/tree/version-3#allow-multiple-provider-states-with-parameters
A provider state can be defined by string only.
See the interface used to define an interaction that it can only receive a string for provider state
https://github.com/pact-foundation/pact-js/blob/3d66117c5b3ba0f2f15c9b29f5651c4eab1217cb/src/dsl/interaction.ts#L28
none
I am in a project which used to be consisted of Java services only which have defined many providers with parameters. With pact-js I cannot reuse these providers.
Thanks. We know this is lacking as it is a v3 feature. I'm going to create a separate issue later tonight to track the v3 implementation, but work is already underway (see the v3 branch).
@mefellows thanks a lot!
Is there any way to work around this with the v2 specification?
Example:
The consumer test registers a new user using her email address [email protected]. The provider state setup function must execute a query to make sure that the email address does not exist yet.
The better way to handle that solution is that the datasources should all be cleared at the start of the provider state set up call. Then you would know that it does not exist.
As Beth said. But also, you could have two separate tests and states
e.g.
"... when user [email protected] exists""... when user [email protected] does not exist"You don't need a state parameter to do this.
Most helpful comment
As Beth said. But also, you could have two separate tests and states
e.g.
"... when user [email protected] exists""... when user [email protected] does not exist"You don't need a state parameter to do this.