Created
June 13, 2018 16:17
-
-
Save JakeDawkins/cb95885c0a1d98fd32162ff2a5409ae1 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
| // dog.test.js | |
| import { MockedProvider } from 'react-apollo/test-utils'; | |
| // The component AND the query need to be exported | |
| import { GET_DOG_QUERY, Dog } from './dog'; | |
| const mocks = [ | |
| { | |
| request: { | |
| query: GET_DOG_QUERY, | |
| variables: { | |
| name: 'Buck', | |
| }, | |
| }, | |
| result: { | |
| data: { | |
| dog: { id: '1', name: 'Buck', breed: 'bulldog' }, | |
| }, | |
| }, | |
| }, | |
| ]; | |
| it('renders without error', () => { | |
| renderer.create( | |
| <MockedProvider mocks={mocks} addTypename={false}> | |
| <Dog name="Buck" /> | |
| </MockedProvider>, | |
| ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment