Last active
September 6, 2016 01:49
-
-
Save jbaxleyiii/29cfe383fc3b25dad6156afcf832c2d1 to your computer and use it in GitHub Desktop.
This file contains 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
it('executes a query', (done) => { | |
const query = gql` query people { allPeople(first: 1) { people { name } } }`; | |
const data = { allPeople: { people: [ { name: 'Luke Skywalker' } ] } }; | |
const networkInterface = mockNetworkInterface({ request: { query }, result: { data } }); | |
const client = new ApolloClient({ networkInterface }); | |
const withGraphQL = graphql(query); | |
class Container extends Component { | |
componentWillReceiveProps(props) { | |
expect(props.data.loading).to.be.false; | |
expect(props.data.allPeople).to.deep.equal(data.allPeople); | |
done(); | |
} | |
render() { | |
return null; | |
} | |
}; | |
const ContainerWithData = withGraphQL(Container); | |
mount(<ApolloProvider client={client}><ContainerWithData /></ApolloProvider>); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment