Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oojacoboo committed Oct 11, 2023
1 parent cc37962 commit ef0cea5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ const createSamples = (fields) => {
* @returns {Promise<String>} 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);
Expand Down
24 changes: 8 additions & 16 deletions test/lib/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const path = require('path');
const {
createDefaultConfigFile,
setConfig,
createAllOpreationFiles,
createQueryFile,
createMutationFile,
createActionFile,
} = require('../../lib');
const Config = require('../../lib/Config');

Expand Down Expand Up @@ -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');
});
});

0 comments on commit ef0cea5

Please sign in to comment.