Mock/Test Mongodb Database Node.js

后端 未结 3 1254
离开以前
离开以前 2021-02-05 03:36

I am learning nodejs and I have a mongodb database with which i have to interact with. I am currently thinking of using mocha for a unit test framework and zombie.js for a acce

3条回答
  •  太阳男子
    2021-02-05 04:06

    If your database access is a separate module, you can mock out the module or parts of the module (e.g., the configuration part) using one of the following:

    • sinon
    • rewire
    • horaa
    • sandboxed-module

    The answers to the following related question lists a number of possible solutions/approaches: How do you mock MySQL (without an ORM) in Node.js?

提交回复
热议问题