Skip to content

Commit 11b3d0b

Browse files
committed
Add tests for when we have args AND directives
1 parent ce78af9 commit 11b3d0b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/__tests__/jsonToGraphQLQuery.tests.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,35 @@ describe('jsonToGraphQL()', () => {
146146
}`);
147147
});
148148

149+
it('converts a simple query with args and directives with no arguments', () => {
150+
const query = {
151+
query: {
152+
Posts: {
153+
__args: {
154+
where: {
155+
id: 10,
156+
},
157+
orderBy: 'flibble'
158+
},
159+
__directives: {
160+
client: true
161+
},
162+
id: true,
163+
title: true,
164+
post_date: true
165+
}
166+
}
167+
} as any;
168+
expect(jsonToGraphQLQuery(query, { pretty: true })).to.equal(
169+
`query {
170+
Posts @client (where: {id: 10}, orderBy: 'flibble') {
171+
id
172+
title
173+
post_date
174+
}
175+
}`);
176+
});
177+
149178
it('Converts a complex query with directives with no arguments', () => {
150179
const query = {
151180
query: {

0 commit comments

Comments
 (0)