Zied Bejaoui
04/04/2024, 8:48 AMMatt (pactflow.io / pact-js / pact-go)
Zied Bejaoui
04/04/2024, 9:26 AMZied Bejaoui
04/04/2024, 2:05 PMdescribe("receive transfer event", () => {
it("accepts a transfer", () => {
return messagePact
.given("a new transfer")
.expectsToReceive("a request for a new transfer")
.withContent(transferBodyExpectation)
.withMetadata({
queue: like("transfers"),
})
.verify(synchronousBodyHandler(actionHandler));
});
});
});
In my SUT code actionHandler
is calling a real KAFKA URL. I thought of refactoring the function so that I can pass a provider mock url in case i am in a contract testing context. Is this a good practice?
Also regarding test maintenance and evolution, if I opt for this method I guess the only update I would need to do would be the structure of the expected response : transferBodyExpectation
right?Slackbot
04/04/2024, 2:05 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
actionHandler
to have any dependencies injected