Skip to content

Commit 02a6a41

Browse files
Vinayak KolagiVinayak Kolagi
authored andcommitted
Added simple mutation test with a return param
1 parent c3a2a57 commit 02a6a41

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/__tests__/mutations.tests.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ import { jsonToGraphQLQuery } from '../';
44

55
describe('jsonToGraphQLQuery() - mutations', () => {
66

7+
it('simple mutation', () => {
8+
const mutation = {
9+
mutation: {
10+
delete_post: {
11+
__args: { id: 1234 },
12+
id: true,
13+
}
14+
}
15+
}
16+
expect(jsonToGraphQLQuery(mutation, { pretty: true })).to.equal(
17+
`mutation {
18+
delete_post (id: 1234) {
19+
id
20+
}
21+
}`);
22+
})
23+
724
it('correctly converts mutations with no specified return fields', () => {
825
const query = {
926
mutation: {

0 commit comments

Comments
 (0)