question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

watchQuery never resolving in tests

See original GitHub issue

I have a case where we call apollo.watchQuery(...) (via import { queryManager } from 'ember-apollo-client';), which never “finishes” in our test (it does resolve, but the test waiters do not continue). Replacing it with apollo.query() works as expected, but otherwise the test just hangs on await visit(...) and never resolves. Any ideas on this, or ways to work around this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mydeacommented, Sep 25, 2020

Hmm, I guess it would make sense to call clearStore() in the willDestroy() hook of the apollo service? I will make a PR for that!

0reactions
christophermlnecommented, Sep 25, 2020

@gfmartinez a dummy app would be great but a gist with a config.js sample and sample test, would also be valuable. Even better if that example could be linked to from the readme for this add-on

Read more comments on GitHub >

github_iconTop Results From Across the Web

jest testing apollo provider getting error : TypeError: this.client ...
then I wrapped component in apollo provider with prop client while testing. TypeError: this.client.watchQuery is not a function 732 | 733 | it(' ......
Read more >
Testing Apollo's Query Component - Apollo GraphQL Blog
This behavior affects how tests should be written for components that use react-apollo . This guide will explain step-by-step how to test react- ......
Read more >
Writing Tests for Apollo Client in React - Robin Wieruch
The tutorial builds up on a mocked GraphQL API enabling you to write tests for your Apollo Client queries and mutations in React....
Read more >
Unit testing a Flutter GraphQL app | by Dana Hartweg - Medium
Watch query test harness. Lines 24–28 are more mocktail specific setup, but nothing we haven't seen before; Lines 1–2 set things up ...
Read more >
Queries – Angular - GraphQL Code Generator
watchQuery method in a very simple way. We simply need to parse our query into a GraphQL document using the gql tag from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found