cat introspection_query.json
{
"query": "query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
export default (interrogate, mockImplementations = {}) => { | |
const spies = {} | |
interrogate.prototype && Object.getOwnPropertyNames(interrogate.prototype).forEach((name) => { | |
if (name !== 'constructor') { | |
spies[`${name}Spy`] = createSpy(interrogate.prototype, mockImplementations, name) | |
} | |
// AFAIK, you can't spy on a constructor | |
// top answer is here: https://stackoverflow.com/a/48486214/1090606 | |
// For now, mock the entire module to assert that the constructor was called correctly. |