From f518fcd911aee7e7fb2862d6ba3294adaa2b088a Mon Sep 17 00:00:00 2001 From: alejandrobailo Date: Thu, 25 Jun 2026 19:51:19 +0200 Subject: [PATCH] test(ui): remove brittle source-string Lighthouse tests --- ...ighthouse-v2-navigation-mode-sync.test.tsx | 34 ------------------- ui/app/(prowler)/lighthouse/page.test.ts | 28 --------------- .../lighthouse/settings/page.test.ts | 18 ---------- 3 files changed, 80 deletions(-) delete mode 100644 ui/app/(prowler)/lighthouse/_components/navigation/lighthouse-v2-navigation-mode-sync.test.tsx delete mode 100644 ui/app/(prowler)/lighthouse/page.test.ts delete mode 100644 ui/app/(prowler)/lighthouse/settings/page.test.ts diff --git a/ui/app/(prowler)/lighthouse/_components/navigation/lighthouse-v2-navigation-mode-sync.test.tsx b/ui/app/(prowler)/lighthouse/_components/navigation/lighthouse-v2-navigation-mode-sync.test.tsx deleted file mode 100644 index 572f098d78..0000000000 --- a/ui/app/(prowler)/lighthouse/_components/navigation/lighthouse-v2-navigation-mode-sync.test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { render, waitFor } from "@testing-library/react"; -import { describe, expect, it, vi } from "vitest"; - -import { SIDEBAR_NAVIGATION_MODE } from "@/hooks/use-sidebar"; - -import { LighthouseV2NavigationModeSync } from "./lighthouse-v2-navigation-mode-sync"; - -const setNavigationModeMock = vi.fn(); - -vi.mock("@/hooks/use-sidebar", () => ({ - SIDEBAR_NAVIGATION_MODE: { - BROWSE: "browse", - CHAT: "chat", - }, - useSidebar: ( - selector: (state: { - setNavigationMode: typeof setNavigationModeMock; - }) => unknown, - ) => selector({ setNavigationMode: setNavigationModeMock }), -})); - -describe("LighthouseV2NavigationModeSync", () => { - it("sets the sidebar navigation mode to chat on mount", async () => { - // Given / When - render(); - - // Then - await waitFor(() => - expect(setNavigationModeMock).toHaveBeenCalledWith( - SIDEBAR_NAVIGATION_MODE.CHAT, - ), - ); - }); -}); diff --git a/ui/app/(prowler)/lighthouse/page.test.ts b/ui/app/(prowler)/lighthouse/page.test.ts deleted file mode 100644 index 8283b20551..0000000000 --- a/ui/app/(prowler)/lighthouse/page.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { readFileSync } from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; - -import { describe, expect, it } from "vitest"; - -describe("Lighthouse page", () => { - const currentDir = path.dirname(fileURLToPath(import.meta.url)); - const pagePath = path.join(currentDir, "page.tsx"); - const source = readFileSync(pagePath, "utf8"); - - it("keys the Cloud chat by the active route conversation", () => { - // Given / When / Then - expect(source).toContain( - 'const chatRouteKey = activeSessionId ?? initialPrompt ?? "new";', - ); - expect(source).toContain("key={chatRouteKey}"); - }); - - it("renders the Cloud chat inside the shared application layout", () => { - // Given / When / Then - expect(source).toContain( - '}>', - ); - expect(source).toContain('className="h-[calc(100dvh-6.5rem)] min-h-0"'); - expect(source).not.toContain('className="h-dvh min-h-0 p-4 pr-6"'); - }); -}); diff --git a/ui/app/(prowler)/lighthouse/settings/page.test.ts b/ui/app/(prowler)/lighthouse/settings/page.test.ts deleted file mode 100644 index c649166167..0000000000 --- a/ui/app/(prowler)/lighthouse/settings/page.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { readFileSync } from "node:fs"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; - -import { describe, expect, it } from "vitest"; - -describe("Lighthouse settings page", () => { - const currentDir = path.dirname(fileURLToPath(import.meta.url)); - const pagePath = path.join(currentDir, "page.tsx"); - const source = readFileSync(pagePath, "utf8"); - - it("uses Settings as the breadcrumb title", () => { - // Given / When / Then - expect(source).toContain(''); - expect(source).not.toContain("contentClassName="); - expect(source).not.toContain("Lighthouse Configuration"); - }); -});