You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to stub a function, returning a fake value and comparing Sinon and Testdouble implementations. So, for the former, I'm using this command:
sinon.stub(catHelper,'getCategoryByPath').callsFake(function(){
let result = {
id:1
};
return result;
});
It works fine, Sinon can recognize the getCategoryByPath function inside the catHelper object.
I tried to achieve the same result using TestDouble, so I did the same logic:
let catHelperMock = testdouble.replace(catHelper,'getCategoryByPath');
testdouble.when(catHelperMock.getCategoryByPath('path','')).thenReturn(
{
id:1
});
But I'm getting the following error:
TypeError: catHelperMock.getCategoryByPath is not a function
For some reason, it's not recognizing the funciotn. Is there an alternative to achieve the same result?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to stub a function, returning a fake value and comparing Sinon and Testdouble implementations. So, for the former, I'm using this command:
It works fine, Sinon can recognize the getCategoryByPath function inside the catHelper object.
I tried to achieve the same result using TestDouble, so I did the same logic:
But I'm getting the following error:
TypeError: catHelperMock.getCategoryByPath is not a function
For some reason, it's not recognizing the funciotn. Is there an alternative to achieve the same result?
Thanks!
The text was updated successfully, but these errors were encountered: