Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A query generator to test graphql servers.
if (!process.argv[2]) process.exit();
const generateQuery = (iter) => {
if (iter === 0) {
return ` x { y { yAttribute } } `;
} else {
return ` x { y { ${generateQuery(iter - 1)} } }`;
}
}
const query = `{
entryQuery(args) {
${generateQuery(process.argv[2])}
}
}
// node index.js 100 will generate a query 100 levels deep.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.