Skip to content

Commit

Permalink
update graphql.test formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
KatieMSB committed Feb 28, 2025
1 parent 4c99517 commit 2a5edcd
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions web/src/app/util/graphql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
prefixQuery,
} from './graphql'

const expectEqual = (a: DocumentNode, b: DocumentNode) => expect(print(a)).toBe(print(b))
const expectEqual = (a: DocumentNode, b: DocumentNode): void =>
expect(print(a)).toBe(print(b))

describe('queryByName', () => {
it('should fetch a single query', () => {
Expand All @@ -32,7 +33,12 @@ describe('queryByName', () => {
})

describe('fieldAlias', () => {
const check = (name: string, arg: string, query: DocumentNode, expected: DocumentNode) =>
const check = (
name: string,
arg: string,
query: DocumentNode,
expected: DocumentNode,
): void =>
test(name, () =>
expect(print(fieldAlias(query, arg))).toBe(print(expected)),
)
Expand Down Expand Up @@ -77,7 +83,12 @@ describe('fieldAlias', () => {
})

describe('prefixQuery', () => {
const check = (name: string, arg: string, query: DocumentNode, expected: DocumentNode) =>
const check = (
name: string,
arg: string,
query: DocumentNode,
expected: DocumentNode,
): void =>
test(name, () =>
expect(print(prefixQuery(query, 'q0_'))).toBe(print(expected)),
)
Expand Down Expand Up @@ -113,7 +124,12 @@ describe('prefixQuery', () => {
})

describe('mapInputVars', () => {
const check = (name: string, arg: Record<string, string>, query: DocumentNode, expected: DocumentNode) =>
const check = (
name: string,
arg: Record<string, string>,
query: DocumentNode,
expected: DocumentNode,
): void =>
test(name, () =>
expect(print(mapInputVars(query, arg))).toBe(print(expected)),
)
Expand Down Expand Up @@ -183,7 +199,12 @@ describe('mapInputVars', () => {
})

describe('mergeFields', () => {
const check = (name: string, query1: DocumentNode, query2: DocumentNode, expected: DocumentNode) =>
const check = (
name: string,
query1: DocumentNode,
query2: DocumentNode,
expected: DocumentNode,
): void =>
test(name, () =>
expect(print(mergeFields(query1, query2))).toBe(print(expected)),
)
Expand Down

0 comments on commit 2a5edcd

Please sign in to comment.