Skip to content

Commit dc9c226

Browse files
committed
test: update tests to use queryClient prop when providing custom client
1 parent 802d1a2 commit dc9c226

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/context/StacApiProvider.test.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('StacApiProvider', () => {
6060

6161
render(
6262
<QueryClientProvider client={parentClient}>
63-
<StacApiProvider apiUrl="https://test-stac-api.com">
63+
<StacApiProvider apiUrl="https://test-stac-api.com" queryClient={parentClient}>
6464
<TestComponent />
6565
</StacApiProvider>
6666
</QueryClientProvider>
@@ -83,7 +83,7 @@ describe('StacApiProvider', () => {
8383

8484
render(
8585
<QueryClientProvider client={parentClient}>
86-
<StacApiProvider apiUrl="https://test-stac-api.com">
86+
<StacApiProvider apiUrl="https://test-stac-api.com" queryClient={parentClient}>
8787
<ClientChecker />
8888
</StacApiProvider>
8989
</QueryClientProvider>
@@ -130,20 +130,22 @@ describe('StacApiProvider', () => {
130130
).toBeDefined();
131131
});
132132

133-
it('sets up DevTools with parent QueryClient when enabled', () => {
134-
const parentClient = new QueryClient();
133+
it('sets up DevTools with custom queryClient when enabled', () => {
134+
const customClient = new QueryClient();
135135

136136
render(
137-
<QueryClientProvider client={parentClient}>
138-
<StacApiProvider apiUrl="https://test-stac-api.com" enableDevTools={true}>
139-
<TestComponent />
140-
</StacApiProvider>
141-
</QueryClientProvider>
137+
<StacApiProvider
138+
apiUrl="https://test-stac-api.com"
139+
enableDevTools={true}
140+
queryClient={customClient}
141+
>
142+
<TestComponent />
143+
</StacApiProvider>
142144
);
143145

144146
expect(
145147
(window as Window & { __TANSTACK_QUERY_CLIENT__?: unknown }).__TANSTACK_QUERY_CLIENT__
146-
).toBe(parentClient);
148+
).toBe(customClient);
147149
});
148150
});
149151

0 commit comments

Comments
 (0)