Open distante opened 3 years ago
I have this interface mock on my before each test
SplashScreenMock = mock<SplashScreenPlugin>(); when(SplashScreenMock.hide()).thenResolve();
when I try to check if it was called using verify(SplashScreenMock.hide()).once() I always says it never was called.
verify(SplashScreenMock.hide()).once()
My workaround is to manually create a partial mock instead
SplashScreenMock = { hide: jest.fn() } as any;
and test it with expect(SplashScreenMock.hide).toHaveBeenCalledTimes(1); (which works just fine)
expect(SplashScreenMock.hide).toHaveBeenCalledTimes(1);
The code is implemented in this way
this.globalEvents.homePageFinishLoading$.pipe(first()).subscribe(async () => { await this.splashScreen.hide(); this.logger.log('hideSplashScreen Done'); });
I have this interface mock on my before each test
when I try to check if it was called using
verify(SplashScreenMock.hide()).once()
I always says it never was called.My workaround is to manually create a partial mock instead
and test it with
expect(SplashScreenMock.hide).toHaveBeenCalledTimes(1);
(which works just fine)The code is implemented in this way