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

Testing Modules - Property 'resolvers' does not exist on type GraphQLModule<any, any, any> #300

Closed
markcdev opened this issue Jan 29, 2019 · 7 comments
Labels
bug Something isn't working docs

Comments

@markcdev
Copy link

Following the example from the testing documentation and getting an error with the resolvers property not being available on my module. I tried using the selfResolvers property instead and i'm not sure if it's related but my provider isn't being swapped out for the new test one configured in my test module and so it's calling the actual implementation.

@ardatan
Copy link
Collaborator

ardatan commented Jan 30, 2019

Which version of graphql-modules are you using?

@markcdev
Copy link
Author

@ardatan I downgraded from 0.3.0 to 0.2.18 and I can see the property now. However it still isn't switching out the implementation for the mock

@tlivings
Copy link

tlivings commented Feb 1, 2019

Same problem. The overwrite: true for provider doesn't seem to do anything.

Also, in the example it seems like the useValue is providing an override to the resolvers name as opposed to provider's function name. I'd expect the latter considering it is an override on provider?

In general, this doesn't seem like "injecting" a mock provider into the module. This is mentioned in the dependency injection section specifically referring to tests but remains unclear.

@tlivings
Copy link

tlivings commented Feb 7, 2019

Any updates?

@markcdev
Copy link
Author

Any news on this?

@ardatan
Copy link
Collaborator

ardatan commented Feb 20, 2019

The bug is related to overwriting an existing provider by using;

injector.provide({
   provide: ExistingProvider,
   overwrite: true,
   useClass: MockProvider
})

I created a PR for this issue, and published an alpha release;

- @graphql-modules/core@0.5.0-alpha.778c470a
 - @graphql-modules/di@0.5.0-alpha.778c470a

So, could you try testing your module again with this alpha version?
Please read the updated documentation before doing that;
https://github.com/Urigo/graphql-modules/blob/test-modules/docs/introduction/test-your-module.md

@ardatan ardatan added enhancement docs bug Something isn't working labels Feb 20, 2019
@ardatan
Copy link
Collaborator

ardatan commented Mar 18, 2019

Fixed in 0.6.5

@ardatan ardatan closed this as completed Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs
Projects
None yet
Development

No branches or pull requests

3 participants