如何使用sinon对来自React Components的api调用进行存根?

时间:2018-07-19 15:23:19

标签: reactjs unit-testing sinon

任何帮助。

我遇到了以下错误

Error: Error: connect ETIMEDOUT 1.2.3.4:80
at Object.dispatchError (V:\Users\bbalapqz\git\Working\nominator\node_modules\jsdom\lib\jsdom\living\xhr-utils.js:65:19)
at Request.client.on.err (V:\Users\bbalapqz\git\Working\nominator\node_modules\jsdom\lib\jsdom\living\xmlhttprequest.js:676:20)
at emitOne (events.js:101:20)
at Request.emit (events.js:188:7)
at Request.onRequestError (V:\Users\bbalapqz\git\Working\nominator\node_modules\request\request.js:877:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:309:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1277:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9) undefined

(节点:6640)UnhandledPromiseRejectionWarning:未处理的承诺拒绝(拒绝ID:14):true

使用的单元测试堆栈是黄瓜+酶+西农

0 个答案:

没有答案