Last active
June 13, 2018 16:19
-
-
Save JakeDawkins/c7f8f07cdb0b81e4a9d1274ed819705c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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