sinon.spyを使用して通話を録音しようとしています
beforeEach :
// Get restify JSON clinet instance
// Using rewire
// m_jsonClient is a private field
m_jsonClient = myMod.__get__('m_jsonClient')
jsonClientGetSpy = sandbox.spy(m_jsonClient, 'get')
それ:
sut.FunctionThatCallsGetMethodOfJsonClient(,,,function (err, ..) {
jsonClientGetSpy.getCall(0).args[0] // url , i.e. /customers/123
jsonClientGetSpy.getCall(0).args[1] // Callback Function
// How can I access arguments?
// If myMod uses strict mode I got
// TypeError: 'caller', 'callee', and 'arguments' properties
// may not be accessed on strict mode functions or the arguments
// objects for calls to them
// Otherwise
// null
jsonClientGetSpy.getCall(0).args[1].arguments
})
スパイされた関数が同期されていない場合、コールバックで「戻り値」にアクセスすることは可能ですか?