Feature: Create set of mock functions for ng test
See original GitHub issueAs of now when using Apollo in app, the spec fails, complaining for something along the lines of:
Error: Client has not been defined yet
. I think it would be useful to have an internal mock available simply by importing it as a module in test e.g.:
imports: [
ApolloMockModule
]
Any suggestions as to how this feature might be implemented are more than welcome as well. Thank you.
Note: I’ve noticed in the Apollo.spec.ts file, there is an apolloMock function: https://github.com/apollographql/apollo-angular/blob/master/packages/apollo-angular/tests/Apollo.spec.ts
Perhaps making this function available as an export, in the mocks folder(https://github.com/apollographql/apollo-angular/tree/master/packages/apollo-angular/tests/mocks) with the appropriate documentation, would solve this feature request.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top GitHub Comments
v1.1.0 is going to have
apollo-angular/testing
, same experience as in@angular/common/http/testing
I expected to have something like
ApolloTestingModule
similar as we haveHttpClientTestingModule
by the Angular team, but unfortunately, I didn’t find anything. So, yeah this common testing module is highly needed.