Stubbing Redis interactions in javascript using Sinon

后端 未结 5 801
陌清茗
陌清茗 2020-12-16 00:15

I am working in node.js. My app interacts with Redis via the node_redis module. I\'m using mocha and sinon to automate testing of my app. My app looks somethi

5条回答
  •  独厮守ぢ
    2020-12-16 00:51

    You can also use something like redis-mock which is a drop in replacement for node_redis that runs in memory.

    Use rewire (or Jest module mocks or whatever) to load the mock client in your tests instead of the real client and run all your tests against the in-memory version.

提交回复
热议问题