Radu Millio
09/17/2024, 11:51 AM// UI consumer of an endpoint uses name and content
const { name, content } = useGetItemById('123');
Having this UI code, I want to write a pact test in a way that the test fails on the consumer's side if another dev changes the UI code into this and forgets to update the pact test:
const { name } = useGetItemById('123');
With this updated UI, the consumer no longer needs the content key and but the backend has no way of knowing this if the contract wasn't updated. Also, if the pact test doesn't fail after this change then the dev might forget to update the contract and the contract will become obsolete.
Sorry if this is already answered somewhere in the docs or in this channel. I have a rough idea on how to implement this but I'm looking to find out how others would implement it. Didn't write the approach so that whoever reads this can read it with a fresh perspective.