Skip to content

Instantly share code, notes, and snippets.

@stubailo
Last active November 26, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stubailo/9473f71aeea5040c3e5be98675b92c5e to your computer and use it in GitHub Desktop.
Save stubailo/9473f71aeea5040c3e5be98675b92c5e to your computer and use it in GitHub Desktop.
A Jest test with ApolloMockingProvider
it('renders a list', async () => {
const customResolvers = {
Todo: () => ({
text: 'My todo item',
}),
};
const wrapper = mount(
<ApolloMockingProvider customResolvers={customResolvers}>
<TodoList />
</ApolloMockingProvider>,
);
await wait(0); // Use a waiting library of your choice
const text = wrapper.text();
expect(text).toMatch(/My todo item/);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment