From 4913fe15f9975f129e24b4c744126f00a45cb636 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 3 Oct 2024 09:41:19 -0400 Subject: [PATCH] chore: refactor test suite --- src/layers/6_client/raw/client.raw.test-d.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/layers/6_client/raw/client.raw.test-d.ts b/src/layers/6_client/raw/client.raw.test-d.ts index 0e0cec28..69883c94 100644 --- a/src/layers/6_client/raw/client.raw.test-d.ts +++ b/src/layers/6_client/raw/client.raw.test-d.ts @@ -1,14 +1,12 @@ import { describe, expectTypeOf } from 'vitest' import { test } from '../../../../tests/_/helpers.js' import { gql } from '../../6_helpers/gql.js' -import type { RawResolveOutputReturnRootType } from '../handleOutput.js' describe(`TypedQueryDocumentNode`, () => { describe(`data`, () => { const document = gql<{ id: string }, {}>`query { id }` - test(`envelope data is typed`, ({ kitchenSink: g }) => { - type ExpectedType = RawResolveOutputReturnRootType - expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf() + test(`envelope data is typed`, async ({ kitchenSink: g }) => { + expectTypeOf(await g.raw({ document })).toEqualTypeOf() }) test(`variables are not allowed to be passed in`, async ({ kitchenSink: g }) => { // @ts-expect-error - variables not allowed. @@ -19,9 +17,7 @@ describe(`TypedQueryDocumentNode`, () => { describe(`data + optional variables`, () => { const document = gql<{ id: string }, { filter?: boolean }>`query { id }` test(`envelope data is typed`, ({ kitchenSink: g }) => { - expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf< - RawResolveOutputReturnRootType - >() + expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf<{ id: string } | null>() }) test(`variables are typed and allowed to be passed in or omitted`, async ({ kitchenSink: g }) => { // Expect no type errors below