From 0f9babb7ffd6c08b7c570deed0e1ab25eb5f4946 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Thu, 18 Jun 2026 10:03:48 +0300 Subject: [PATCH] test(site-finder): wrap MiniMap test render in QueryClientProvider (#1736) #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). --- .../analysis/__tests__/MiniMap.test.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/site-finder/analysis/__tests__/MiniMap.test.tsx b/frontend/src/components/site-finder/analysis/__tests__/MiniMap.test.tsx index 636d7508..e6af0005 100644 --- a/frontend/src/components/site-finder/analysis/__tests__/MiniMap.test.tsx +++ b/frontend/src/components/site-finder/analysis/__tests__/MiniMap.test.tsx @@ -1,3 +1,4 @@ +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { render, screen, waitFor } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; @@ -39,9 +40,23 @@ const FIXTURE: ParcelAnalyzeResponse = { 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( + + + , + ); +} + describe("MiniMap (#1218)", () => { it("passes mapHeight=280 to SiteMap (compact tile, controls flow below)", async () => { - render(); + renderMiniMap(); // SiteMap is dynamically imported (ssr:false) — wait until our stub renders. await waitFor(() => 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 () => { - const { container } = render(); + const { container } = renderMiniMap(); await waitFor(() => expect(screen.getByTestId("sitemap-stub")).toBeInTheDocument(), );