Skip to content

Commit

Permalink
FIX Make graphql template abstractions work with gql3
Browse files Browse the repository at this point in the history
The input parameters must be lowercase.
  • Loading branch information
GuySartorelli committed Apr 12, 2023
1 parent e0f8234 commit 224196e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { getSingularName, getFields, getFragments } from './helpers';

const buildCreateMutation = (tag = defaultTag) => (
tag`mutation Create${getSingularName}(
$Input:${getSingularName}CreateInputType!
$input:${getSingularName}CreateInputType!
) {
create${getSingularName}(
Input: $Input
input: $input
) {
${getFields}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { getSingularName, getVariables, getParams, getFields, getFragments } fro

const buildUpdateMutation = (tag = defaultTag) => (
tag`mutation Update${getSingularName}(
$Input:${getSingularName}UpdateInputType!
$input:${getSingularName}UpdateInputType!
${getVariables}
) {
update${getSingularName}(
Input: $Input
input: $input
${getParams}
) {
${getFields}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Dynamic graphql injection', () => {

expect(AST.kind).toBe('Document');
const compiledQuery = AST.loc.source.body;
expect(compiledQuery).toMatch(/\s*mutation\s+UpdateDino\(\s*\$Input:\s*DinoUpdateInputType!\s*\)\s+{\s+updateDino\(\s*Input:\s*\$Input\s*\)\s+{\s+Teeth Plates\s+}\s+}\s*$/);
expect(compiledQuery).toMatch(/\s*mutation\s+UpdateDino\(\s*\$input:\s*DinoUpdateInputType!\s*\)\s+{\s+updateDino\(\s*input:\s*\$input\s*\)\s+{\s+Teeth Plates\s+}\s+}\s*$/);
});

it('Allows customisation of DELETE queries', () => {
Expand Down Expand Up @@ -224,7 +224,7 @@ describe('Dynamic graphql injection', () => {

expect(AST.kind).toBe('Document');
const compiledQuery = AST.loc.source.body;
expect(compiledQuery).toMatch(/\s*mutation\s+CreateDino\(\s*\$Input:\s*DinoCreateInputType!\s*\)\s+{\s+createDino\(\s*Input:\s*\$Input\s*\)\s+{\s+Club Claws\s+}\s+}\s*$/);
expect(compiledQuery).toMatch(/\s*mutation\s+CreateDino\(\s*\$input:\s*DinoCreateInputType!\s*\)\s+{\s+createDino\(\s*input:\s*\$input\s*\)\s+{\s+Club Claws\s+}\s+}\s*$/);
});
});

0 comments on commit 224196e

Please sign in to comment.