Created
July 24, 2018 12:54
-
-
Save ananth99/115eb62b74e8f596def8f4bb5adbeeea 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
// mocked schema for tests. | |
import { ApolloClient, InMemoryCache } from 'apollo-boost'; | |
import { SchemaLink } from 'apollo-link-schema'; | |
import { | |
addMockFunctionsToSchema, | |
} from 'graphql-tools'; | |
import { buildClientSchema } from 'graphql'; | |
import * as introspectionResult from './schema.json'; | |
import mocks from '../mocks'; | |
const schema = buildClientSchema(introspectionResult); | |
addMockFunctionsToSchema({ | |
schema, | |
mocks, | |
preserveResolvers: false, | |
}); | |
export const mockedClient = new ApolloClient({ | |
cache: new InMemoryCache(), | |
link: new SchemaLink({ schema }), | |
}); | |
export default mockedClient; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment