#848 [V3] provider states with the same name are not exported to pact file
Issue created by
individual-it
Software versions
Please provide at least OS and version of pact-js
•
OS: Ubuntu 21.04
•
Consumer Pact library: Pact JS v10.0.0-beta.59
•
Provider Pact library: Pact JS v10.0.0-beta.59
•
Node Version: v16.0.0
Issue Checklist
Please confirm the following:
☐ I have upgraded to the latest
☐ I have the read the FAQs in the Readme
☐ I have triple checked, that there are
no unhandled promises in my code and have
read the section on intermittent test failures
☐ I have set my log level to debug and attached a log file showing the complete request/response cycle
☐ For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem
Expected behaviour
all provider states are saved to JSON
This would be useful when the provider test needs more than one set of testdata of the same type to be useful. E.g. create multiple files and list them, create multiple users, etc.
Actual behaviour
only one provider state is saved to JSON
Steps to reproduce
create multiple provider states with the same name
My use-case is to create multiple files. So I call multiple times
provider.given('file exists', { username, password, fileName: resource })
but in the JSON I only have one providerstate with that name
"providerStates": [
{
"name": "the user is recreated",
"params":...
},
{
"name": "file exists",
"params": {
"fileName": "testFolder/文件.txt",
"password": "test123",
"username": "test123"
}
},
{
"name": "resource is shared",
"params": ...
}
]
Making the names of provider states individual makes them appear in the JSON, but that would mean I would also have to have an individual state definition in the provider tests (stateHandlers)
pact-foundation/pact-js