GitHub
10/23/2023, 8:37 PM"generators": {
"query": {
"fooIdentifier": {
"expression": "${fooIdentifier}",
"type": "ProviderState"
}
}
},
"matchingRules": {
"query": {
"fooIdentifier": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
Instead of
"generators": {
"query": {
"$.fooIdentifier[0]": {
"expression": "${fooIdentifier}",
"type": "ProviderState"
}
}
},
"matchingRules": {
"query": {
"$.fooIdentifier[0]": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
}
}
},
If I make this change manually to the pact, then pact-jvm injects the provider state like I would expect.
Actual behaviour
Using json path in the path matchers for query parameters.
Steps to reproduce
Using provider = PactV3({ ... }), have a provider test with something like
provider.given('some state')
.uponReceiving('a request for all the foos'))))
.withRequest({
method: 'GET',
path: '/api/foos',
query: {
fooIdentifier: MatchersV3.fromProviderState('${fooIdentifier}', 'abc123')
})
.willRespondWith({
status: 200
})
And then do the test and generate the state.
pact-foundation/pact-js