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

Apollo service is initializes during integration test without its options #52

Closed
viniciussbs opened this issue Sep 14, 2017 · 5 comments · Fixed by #53
Closed

Apollo service is initializes during integration test without its options #52

viniciussbs opened this issue Sep 14, 2017 · 5 comments · Fixed by #53

Comments

@viniciussbs
Copy link
Contributor

viniciussbs commented Sep 14, 2017

So, the base-query-manager mixin, during the #20 development, was using a query manager got with owner.lookup. The Apollo service was not injected by the mixin.

Today the query manager is got from the Apollo service, that's always injected by the mixin. This is causing an error on integration tests because now the service initializes during the test, but the initializer that injects the options into the service doesn't run during the test. Then Apollo client raises an error saying that the network layer needs an endpoint.

How are you handling this? Are you writing integration tests?

@viniciussbs
Copy link
Contributor Author

@bgentry I've updated the issue with some to references to what I'm talking about.

@viniciussbs
Copy link
Contributor Author

I might be wrong, but I guess this part of the code was discussed with @dfreeman too, but the discussion was lost due to some rebase or forced push into #20.

@dfreeman
Copy link
Contributor

I believe you could get rid of the initializer entirely if you update the service to do something like:

options: computed(function() {
  const config = getOwner(this).resolveRegistration('config:environment');
  return config.apollo;
})

@bgentry
Copy link
Member

bgentry commented Sep 26, 2017

Released in v0.4.5, thanks especially to @dfreeman for having all the answers ✌️

@viniciussbs
Copy link
Contributor Author

Thank you, guys!

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

Successfully merging a pull request may close this issue.

3 participants