From dbd0fd12fbb83a8c32222f63d1324f63867e0b35 Mon Sep 17 00:00:00 2001 From: psteinroe Date: Fri, 8 Dec 2023 21:31:09 +0100 Subject: [PATCH] fix: missing test --- .../__tests__/query/prefetch.integration.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/postgrest-react-query/__tests__/query/prefetch.integration.spec.ts b/packages/postgrest-react-query/__tests__/query/prefetch.integration.spec.ts index 6f3bc16b..feaef48b 100644 --- a/packages/postgrest-react-query/__tests__/query/prefetch.integration.spec.ts +++ b/packages/postgrest-react-query/__tests__/query/prefetch.integration.spec.ts @@ -1,7 +1,7 @@ import { createClient, SupabaseClient } from '@supabase/supabase-js'; import { QueryClient } from '@tanstack/react-query'; -import { prefetchQuery } from '../../src'; +import { fetchQueryInitialData, prefetchQuery } from '../../src'; import type { Database } from '../database.types'; import '../utils'; @@ -34,7 +34,7 @@ describe('prefetch', () => { expect(contacts).toHaveLength(4); }); - it('should throw if query is not a PostgrestBuilder', async () => { + it('prefetchQuery should throw if query is not a PostgrestBuilder', async () => { const queryClient = new QueryClient(); try { await prefetchQuery(queryClient, Promise.resolve({} as any)); @@ -42,4 +42,12 @@ describe('prefetch', () => { expect(error).toEqual(new Error('Key is not a PostgrestBuilder')); } }); + + it('fetchQueryInitialData should throw if query is not a PostgrestBuilder', async () => { + try { + await fetchQueryInitialData(Promise.resolve({} as any)); + } catch (error) { + expect(error).toEqual(new Error('Query is not a PostgrestBuilder')); + } + }); });