Hello, was reading this <part> for provider state ...
# pact-js
j
Hello, was reading this part for provider state in python and was wondering if the same strategies apply to manage states in JS, is there a way to mock this?
j
I believe Pact-JS has a slightly more elegant way of handling internal states by using state handlers: https://github.com/pact-foundation/pact-js/blob/f2d0788ca37801492510013a0aad997feed6b954/examples/v3/provider-state-injected/provider/account-service.test.js#L24-L49 Under the hood, it would work in much the same way as with Python, except that Pact is automatically defining the endpoint.
j
But in this case it would then be isolated from the actual endpoints. So what happens if the schema or logic on the endpoints changes but that test is never updated? Feel like I’m missing something
j
I'm not quite sure I understand your question. If you update the schema for an endpoint (e.g., but adding/removing a field) and don't correspondingly update the test, what are you expecting to happen? Personally, I would expect the test to detect whether the change is compatible or not, and either succeed or fail based on that. In any case, the test is not intended to be a static never-changing fixture; it should in fact be updated to reflect relevant changes in the endpoint.