diff --git a/lib/index.js b/lib/index.js index 74227a6..2ac8d1f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -710,8 +710,8 @@ const createSamples = (fields) => { * @returns {Promise} Query file contents */ const getQueryActionContent = async (action, query) => { - if (!['trigger', 'searche'].includes(action)) { - throw new Error(`Must be 'trigger' or 'searche', not "${action}"`); + if (!['trigger', 'search'].includes(action)) { + throw new Error(`Must be 'trigger' or 'search', not "${action}"`); } const definition = await getQueryDefinition(query); diff --git a/test/lib/index.test.js b/test/lib/index.test.js index 1a2c11e..edf1b0e 100644 --- a/test/lib/index.test.js +++ b/test/lib/index.test.js @@ -5,9 +5,7 @@ const path = require('path'); const { createDefaultConfigFile, setConfig, - createAllOpreationFiles, - createQueryFile, - createMutationFile, + createActionFile, } = require('../../lib'); const Config = require('../../lib/Config'); @@ -54,22 +52,16 @@ describe('createConfigFile', () => { }); -describe('createAllOpreationFiles', () => { - it('should create all the GraphQL operations defined in the schema', async () => { - await createAllOpreationFiles(); +describe('createActionFile', () => { + it('should create the trigger query file', async () => { + await createActionFile('trigger', 'dragon'); }); -}); - -describe('createQueryFile', () => { - it('should create a GraphQL query file', async () => { - await createQueryFile('dragon'); + it('should create the search query file', async () => { + await createActionFile('search', 'dragon'); }); -}); - -describe('createMutationFile', () => { - it('should create a GraphQL mutation file', async () => { - await createMutationFile('delete_users'); + it('should create the create mutation file', async () => { + await createActionFile('create', 'delete_users'); }); });