So, general question
Is there a way to manage "contract" tests for libraries (as opposed to services).
Some context:
As part of the product we build, we have some common functionality in internal libraries. One of the challenges is to know which functions are in use and which can be changed\deleted safely. I wonder if there's a way to manage that. The concept of contracts is very appealing, but the technical parts are completely different.
Yes, you can absolutely use contract tests for this
Timothy Jones
08/29/2023, 1:34 PM
With pact, I think you could (mis)use message pacts to do this. It would work very well.
You'd have a conceptual "message" (a function call with parameters), then your actual test would call the function instead of a message handler.
Timothy Jones
08/29/2023, 1:35 PM
Essentially, contract tests just let you tie mock expectations to what the code actually does. You can use them anywhere you have that problem.
Timothy Jones
08/29/2023, 1:36 PM
technology wise, message pact is really "function call pact" anyway. It doesn't actually send or receive messages like http pact does.
Timothy Jones
08/29/2023, 1:36 PM
to use it for messages you have to write a custom handler.