Skip to content

Commit 7bfc6c4

Browse files
MorganDbsMorgan DUBOIS
andauthored
fixing args / directives order according to gql specs (#45)
Co-authored-by: Morgan DUBOIS <[email protected]>
1 parent a2dfb85 commit 7bfc6c4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/__tests__/directives.tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('jsonToGraphQLQuery() - directives', () => {
2525
} as any;
2626
expect(jsonToGraphQLQuery(query, { pretty: true })).to.equal(
2727
`query {
28-
Posts @client (where: {id: 10}, orderBy: "flibble") {
28+
Posts (where: {id: 10}, orderBy: "flibble") @client {
2929
id
3030
title
3131
post_date
@@ -96,7 +96,7 @@ describe('jsonToGraphQLQuery() - directives', () => {
9696
} as any;
9797
expect(jsonToGraphQLQuery(query, { pretty: true })).to.equal(
9898
`query {
99-
Posts @client @withArgs(id: [1, 2, 3]) (where: {id: 10}, orderBy: "flibble") {
99+
Posts (where: {id: 10}, orderBy: "flibble") @client @withArgs(id: [1, 2, 3]) {
100100
id
101101
title
102102
post_date

src/jsonToGraphQLQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function convertQuery(node: any, level: number, output: [string, number][], opti
123123
argsStr = `(${buildArgs(value.__args)})`;
124124
}
125125
const spacer = directivesExist && argsExist ? ' ' : '';
126-
token = `${token} ${dirsStr}${spacer}${argsStr}`;
126+
token = `${token} ${argsStr}${spacer}${dirsStr}`;
127127
}
128128

129129
output.push([token + (subFields || partialFragmentsExist || fullFragmentsExist ? ' {' : ''), level]);

0 commit comments

Comments
 (0)