Skip to content

Commit 4913fe1

Browse files
committed
chore: refactor test suite
1 parent e5b2ca1 commit 4913fe1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/layers/6_client/raw/client.raw.test-d.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { describe, expectTypeOf } from 'vitest'
22
import { test } from '../../../../tests/_/helpers.js'
33
import { gql } from '../../6_helpers/gql.js'
4-
import type { RawResolveOutputReturnRootType } from '../handleOutput.js'
54

65
describe(`TypedQueryDocumentNode`, () => {
76
describe(`data`, () => {
87
const document = gql<{ id: string }, {}>`query { id }`
9-
test(`envelope data is typed`, ({ kitchenSink: g }) => {
10-
type ExpectedType = RawResolveOutputReturnRootType<typeof g._.context.config, { id: string }>
11-
expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf<ExpectedType>()
8+
test(`envelope data is typed`, async ({ kitchenSink: g }) => {
9+
expectTypeOf(await g.raw({ document })).toEqualTypeOf<null | { id: string }>()
1210
})
1311
test(`variables are not allowed to be passed in`, async ({ kitchenSink: g }) => {
1412
// @ts-expect-error - variables not allowed.
@@ -19,9 +17,7 @@ describe(`TypedQueryDocumentNode`, () => {
1917
describe(`data + optional variables`, () => {
2018
const document = gql<{ id: string }, { filter?: boolean }>`query { id }`
2119
test(`envelope data is typed`, ({ kitchenSink: g }) => {
22-
expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf<
23-
RawResolveOutputReturnRootType<typeof g._.context.config, { id: string }>
24-
>()
20+
expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf<{ id: string } | null>()
2521
})
2622
test(`variables are typed and allowed to be passed in or omitted`, async ({ kitchenSink: g }) => {
2723
// Expect no type errors below

0 commit comments

Comments
 (0)