Skip to content

Instantly share code, notes, and snippets.

@JakeDawkins
Last active June 13, 2018 16:19
Show Gist options
  • Save JakeDawkins/c7f8f07cdb0b81e4a9d1274ed819705c to your computer and use it in GitHub Desktop.
Save JakeDawkins/c7f8f07cdb0b81e4a9d1274ed819705c to your computer and use it in GitHub Desktop.
const wait = require('waait');
it('should render dog', async () => {
const dogMock = {
request: {
query: GET_DOG_QUERY,
variables: { name: 'Buck' },
},
result: {
data: { dog: { id: 1, name: 'Buck', breed: 'poodle' } },
},
};
const component = renderer.create(
<MockedProvider mocks={[dogMock]} addTypename={false}>
<Dog name="Buck" />
</MockedProvider>,
);
await wait(0); // wait for response
const p = component.root.findByType('p');
expect(p.children).toContain('Buck is a poodle');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment