test(site-finder): wrap MiniMap test render in QueryClientProvider (#1736)
All checks were successful
CI / changes (pull_request) Successful in 11s
CI / changes (push) Successful in 15s
CI / frontend-tests (push) Successful in 1m31s
CI / frontend-tests (pull_request) Successful in 1m17s
CI / openapi-codegen-check (push) Successful in 2m28s
CI / openapi-codegen-check (pull_request) Successful in 2m37s
CI / backend-tests (push) Successful in 10m32s
CI / backend-tests (pull_request) Successful in 10m34s
All checks were successful
CI / changes (pull_request) Successful in 11s
CI / changes (push) Successful in 15s
CI / frontend-tests (push) Successful in 1m31s
CI / frontend-tests (pull_request) Successful in 1m17s
CI / openapi-codegen-check (push) Successful in 2m28s
CI / openapi-codegen-check (pull_request) Successful in 2m37s
CI / backend-tests (push) Successful in 10m32s
CI / backend-tests (pull_request) Successful in 10m34s
#1736 added useConnectionPoints (useQuery) to MiniMap, but MiniMap.test.tsx rendered without a QueryClient -> 'No QueryClient set' (2 failing tests in CI frontend-tests). Wrap renders in a QueryClientProvider (retry:false).
This commit is contained in:
parent
e7342d9f98
commit
0f9babb7ff
1 changed files with 17 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import { render, screen, waitFor } from "@testing-library/react";
|
import { render, screen, waitFor } from "@testing-library/react";
|
||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
|
@ -39,9 +40,23 @@ const FIXTURE: ParcelAnalyzeResponse = {
|
||||||
nspd_red_lines: [],
|
nspd_red_lines: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// MiniMap calls useConnectionPoints (useQuery) since #1736 — needs a QueryClient
|
||||||
|
// in context. retry:false so the (unmocked) query fails fast into idle/error
|
||||||
|
// state without affecting these layout-only assertions.
|
||||||
|
function renderMiniMap() {
|
||||||
|
const client = new QueryClient({
|
||||||
|
defaultOptions: { queries: { retry: false } },
|
||||||
|
});
|
||||||
|
return render(
|
||||||
|
<QueryClientProvider client={client}>
|
||||||
|
<MiniMap data={FIXTURE} />
|
||||||
|
</QueryClientProvider>,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
describe("MiniMap (#1218)", () => {
|
describe("MiniMap (#1218)", () => {
|
||||||
it("passes mapHeight=280 to SiteMap (compact tile, controls flow below)", async () => {
|
it("passes mapHeight=280 to SiteMap (compact tile, controls flow below)", async () => {
|
||||||
render(<MiniMap data={FIXTURE} />);
|
renderMiniMap();
|
||||||
// SiteMap is dynamically imported (ssr:false) — wait until our stub renders.
|
// SiteMap is dynamically imported (ssr:false) — wait until our stub renders.
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(screen.getByTestId("sitemap-stub")).toBeInTheDocument(),
|
expect(screen.getByTestId("sitemap-stub")).toBeInTheDocument(),
|
||||||
|
|
@ -50,7 +65,7 @@ describe("MiniMap (#1218)", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("wrapper does NOT clip overflow — layer controls must remain visible", async () => {
|
it("wrapper does NOT clip overflow — layer controls must remain visible", async () => {
|
||||||
const { container } = render(<MiniMap data={FIXTURE} />);
|
const { container } = renderMiniMap();
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(screen.getByTestId("sitemap-stub")).toBeInTheDocument(),
|
expect(screen.getByTestId("sitemap-stub")).toBeInTheDocument(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue