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
When testing the Barrequest function, an error Expected "fooCall(anything())" to be called 1 time(s). But has been called 0 time(s) is thrown.
//whenconstbar=newBar(commLayer);bar.request(foo);//thenverify(MockedFoo.fooCall(anything())).once();// <---- Error: Expected "fooCall(anything())" to be called 1 time(s). But has been called 0 time(s).
When debugging in the IDE, I see that the resolved promise is executed. I notice console.log(value) displays 'result' in the logs.
Environment
Jest: 26.4.2
Typescript: 3.9.7
ts-mockito: 2.6.1
The text was updated successfully, but these errors were encountered:
Summary
I want to test in a service class that a function is called following a resolved promise.
An error
Expected "fooCall(anything())" to be called 1 time(s). But has been called 0 time(s).
is thrown with the below setup.I've looked in the docs and other issues, but haven't found a solution so far.
Data setup
I want to test the
Bar
service class, that uses a comm. layerCommLayer
and performs a callfooCall
to the UIFoo
Mocking
I am mocking the
CommLayer
andFoo
:Tests
When testing the
Bar
request
function, an errorExpected "fooCall(anything())" to be called 1 time(s). But has been called 0 time(s)
is thrown.When debugging in the IDE, I see that the resolved promise is executed. I notice
console.log(value)
displays 'result' in the logs.Environment
The text was updated successfully, but these errors were encountered: