Skip to content

Commit

Permalink
create reproduction for missing __typename
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Dec 9, 2022
1 parent 99e4ca9 commit 82f221e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/core/src/utils/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ describe('stringifyDocument ', () => {
expect(stringifyDocument(formatted)).toBe(print(formatted));
});

it('should reprint gql documents', () => {
const request = createRequest(`query { test { field } }`, {});
const formatted = formatDocument(request.query);
expect(print(formatted)).toMatchInlineSnapshot(`
"{
test {
field
__typename
}
}"
`);
expect(stringifyDocument(formatted)).toBe(print(formatted));
});

it('should remove comments', () => {
const doc = `
{ #query
Expand Down Expand Up @@ -131,7 +145,7 @@ describe('stringifyDocument ', () => {
expect(stringifyDocument(createRequest(doc, undefined).query))
.toMatchInlineSnapshot(`
"{
field(arg:
field(arg:
\\"test #1\\")
}"
Expand All @@ -152,7 +166,7 @@ describe('stringifyDocument ', () => {
expect(stringifyDocument(createRequest(doc, undefined).query))
.toMatchInlineSnapshot(`
"{
field(arg:
field(arg:
\\"\\"\\"
hello
Expand Down

0 comments on commit 82f221e

Please sign in to comment.