hey there :wave: I'm trying to implement a testing...
# pact-js
t
hey there 👋 I'm trying to implement a testing for kafka messages using the NestJS framework. I can't find any examples to guide me on how to implement a simple test with a combination of
nestjs-pact
+
@pact-foundation/pact
+ kafka (or any other messaging queue). Do you have any example to share or any suggestion? Thank you!
t
Have a look at the message examples in the pact-js repository
t
I took a look there but it does not work for NestJS because of the dependency injection stuff. I'm looking for something like this, but for messages, not for REST API.
t
I thought the consumer module had been removed from nest-js pact - it doesn’t really add any benefits
You don’t need to use nestjs-pact for consumer testing
You can just use pact directly
t
it worked @Timothy Jones, thank you for your help. I just had to use NestJS to initialize the nest module and retrieve the service I wanted to test in the
.verify()
function of the
MessageConsumerPact
class. This is necessary because Nest inject dependencies through a module system, so we can't import directly the service in the test file because it can't resolve the dependencies.
🙌 1