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

Custom resolver with no data #36

Closed
draxx318 opened this issue Dec 8, 2020 · 2 comments
Closed

Custom resolver with no data #36

draxx318 opened this issue Dec 8, 2020 · 2 comments

Comments

@draxx318
Copy link

draxx318 commented Dec 8, 2020

Is possible to pass a custom resolver with no data to the ApolloMockedProvider to simulate a scenario where the query returns an empty array?

@sarfata
Copy link
Contributor

sarfata commented Dec 8, 2020

Yes. Just return an empty array.

For example, I have this in my project:

stories.add("Boat selector with no boat", () => (
  <ApolloMockedProvider
    customResolvers={{
      Query: () => ({
        me: () => ({
          boats: [],
        }),
      }),
    }}
  >
    <ControlledBoatSelectorInput />
  </ApolloMockedProvider>
))

If this does not work for you, please send more details.

@draxx318
Copy link
Author

draxx318 commented Dec 9, 2020

Thanks, works like a charm. I was trying to do it the same way but probably had something wrong with the implementation.

@draxx318 draxx318 closed this as completed Dec 9, 2020
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

No branches or pull requests

2 participants