Created
December 23, 2016 05:15
-
-
Save bessey/ce9e0451ce57bb25b5950b1d1f8198a1 to your computer and use it in GitHub Desktop.
Mocked graphql schema, and the error it generates
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
Expected a value of type "Time" but received: 2016-12-23T05:04:10.611Z |
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 resolvers = { | |
Time: () => ({ | |
__serialize: (val) => val, | |
__parseValue: (val) => val, | |
__parseLiteral: (val) => val | |
}) | |
} | |
const mocks = { | |
Time: () => new Date().toISOString() | |
} | |
const schema = makeExecutableSchema({ typeDefs: schemaFile, resolvers: resolvers }) | |
addMockFunctionsToSchema({ schema, mocks }) | |
const client new ApolloClient({ | |
networkInterface: { | |
query: function (request) { | |
return execute( | |
schema, request.query, {}, {}, request.variables, request.operationName | |
).then((result) => { | |
console.log(result.errors) | |
return result | |
}) | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment