【发布时间】:2021-03-31 19:20:56
【问题描述】:
我有一个使用 Node.js pipeline() 的方法,该方法具有回调的最后一个参数。
doSomething(readStream, destinationwritableStream): void {
pipeline(readStream, destinationwritableStream, async () => {
// some code here.
// unable to cover this code using JEST
})
}
任何建议,我如何涵盖此 async() 回调或如何模拟 pipeline() 方法。
提前致谢。
【问题讨论】:
-
你能告诉我你如何导入
pipeline函数吗?
标签: node.js jestjs stream mocking nodejs-stream