Skip to content

Commit

Permalink
fix: missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
psteinroe committed Dec 8, 2023
1 parent bf187d4 commit dbd0fd1
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -34,12 +34,20 @@ 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));
} catch (error) {
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'));
}
});
});

0 comments on commit dbd0fd1

Please sign in to comment.