Created
August 3, 2017 09:05
-
-
Save jakelacey2012/e858a0297890c9727b32d654c93ebd25 to your computer and use it in GitHub Desktop.
A query generator to test graphql servers.
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
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