Skip to content

Commit 328aaa8

Browse files
fix React tests
1 parent c930e0e commit 328aaa8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react/tests/useQuery.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as commonSdk from '@powersync/common';
22
import { PowerSyncDatabase } from '@powersync/web';
33
import { act, cleanup, renderHook, waitFor } from '@testing-library/react';
44
import pDefer from 'p-defer';
5+
import React from 'react';
56
import { beforeEach, describe, expect, it, onTestFinished, vi } from 'vitest';
67
import { PowerSyncContext } from '../src/hooks/PowerSyncContext';
78
import { useQuery } from '../src/hooks/watched/useQuery';
@@ -41,7 +42,10 @@ describe('useQuery', () => {
4142

4243
it('should set isLoading to true on initial load', async () => {
4344
const wrapper = ({ children }) => (
44-
<PowerSyncContext.Provider value={openPowerSync()}>{children}</PowerSyncContext.Provider>
45+
// Placeholder use for `React` to prevent import cleanup from removing the React import
46+
<React.Fragment>
47+
<PowerSyncContext.Provider value={openPowerSync()}>{children}</PowerSyncContext.Provider>
48+
</React.Fragment>
4549
);
4650

4751
const { result } = renderHook(() => useQuery('SELECT * from lists'), { wrapper });

0 commit comments

Comments
 (0)