【文件属性】:
文件名称:mockrequire:模拟所需依赖项的简单模块。 适用于任何测试套件
文件大小:7KB
文件格式:ZIP
更新时间:2021-05-13 14:35:36
testing mock JavaScript
模拟需求
模拟所需依赖项的简单模块。 适用于任何测试套件。 ( )。
用法示例
想象一下,您的应用程序使用以下模块来响应用户收到的事件。 服务将需要模块并调用它,并将事件作为参数传递。 但是,在开发应用程序的过程中,您希望独立于其余代码测试模块。 该模块依赖于另一个模块“ my_db_lib”。
如何隔离测试模块?
var db = require('my_db_lib');
module.exports = function onboardUser (event) {
// we want to test this function's behavior, but need to isolate the behavior of the module apart from the behavior of it's dependency, the db.
db.User.fin
【文件预览】:
mockrequire-master
----.travis.yml(55B)
----test()
--------nestLevel1()
--------nestedfile.test.js(280B)
--------index.js(1KB)
--------support()
----README.md(3KB)
----makefile(415B)
----docs()
--------docs.html(536B)
--------docs.md(451B)
----renovate.json(41B)
----.gitignore(31B)
----index.js(2KB)
----package.json(656B)