Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify on interface mock does not work (2.6.1) #206

Open
distante opened this issue Oct 26, 2020 · 0 comments
Open

Verify on interface mock does not work (2.6.1) #206

distante opened this issue Oct 26, 2020 · 0 comments

Comments

@distante
Copy link

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.

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)

The code is implemented in this way

    this.globalEvents.homePageFinishLoading$.pipe(first()).subscribe(async () => {
      await this.splashScreen.hide();
      this.logger.log('hideSplashScreen Done');
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant