2

I'm writing integration tests for an API in NodeJs that publishes to Google PubSub topics. I don't want to really trigger those external messages in testing environment, so I need some kind of mock.

Since it's an integration test, I think the best approach would be to intercept external network calls to the pubsub service, returning a mocked response.

I tried using nock for this, but it didn't work. I think maybe because google's lib implementation is over gRPC / http2 (?)

Is there any solution to this or a better approach? What am I missing?

Thanks!

Pedro Barros
  • 1,326
  • 1
  • 12
  • 19

0 Answers0