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

attach MockProvider to useClass and useValue if it is possible #599

Closed
satanTime opened this issue May 26, 2021 · 2 comments · Fixed by #2310
Closed

attach MockProvider to useClass and useValue if it is possible #599

satanTime opened this issue May 26, 2021 · 2 comments · Fixed by #2310

Comments

@satanTime
Copy link
Member

An investigation is needed to check whether there is a way how to attach MockInstance to all possible provider configurations.

return MockBuilder(XComponent, XModule)
      .provide([
        { provide: Store, useClass: StoreMock },
      ]);
@satanTime satanTime changed the title attach MockInstance to useClass and useValue if it is possible attach MockProvider to useClass and useValue if it is possible Jul 26, 2021
@satanTime
Copy link
Member Author

Due to ctor deps, there is no an easy way to create instances based on classes. The only way is to use ngMocks.defaultMock, which has access to injector and provides required flexibility.

satanTime added a commit that referenced this issue May 1, 2022
feat(MockProvider): simple generators for different types #599
@satanTime
Copy link
Member Author

v13.5.0 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant