From 4be80657beaf164067a0e08675f951452bd8b3dd Mon Sep 17 00:00:00 2001 From: ZverGuy Date: Tue, 10 Nov 2026 00:41:10 +0700 Subject: [PATCH] test(dashboard): prove /observability/logs opens the application page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The list page shows the same "Loading…" text as the detail page, so the previous check could not tell which route matched. A missing instance makes only the detail page answer with its own name, and the GET it issues names the plural and the application. Assisted-by: LLM Signed-off-by: ZverGuy --- .../src/routes/ConsolePage.routing.test.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/system/dashboard/images/console/apps/console/src/routes/ConsolePage.routing.test.tsx b/packages/system/dashboard/images/console/apps/console/src/routes/ConsolePage.routing.test.tsx index 8e71ff98a..c3b014f4d 100644 --- a/packages/system/dashboard/images/console/apps/console/src/routes/ConsolePage.routing.test.tsx +++ b/packages/system/dashboard/images/console/apps/console/src/routes/ConsolePage.routing.test.tsx @@ -98,14 +98,26 @@ describe("ConsolePage routing", () => { // No ApplicationDefinition plural or application name can be "-", so only // routes under it are safe from shadowing an application's own pages. it("leaves /observability/logs to an application named logs of kind observability", async () => { + const client = makeClient() + vi.mocked(client.list).mockImplementation(async (_g, _v, plural) => ({ + apiVersion: "v1", + kind: `${plural}List`, + metadata: {}, + items: + plural === "tenantnamespaces" + ? [{ apiVersion: "core.cozystack.io/v1alpha1", kind: "TenantNamespace", metadata: { name: "tenant-root" } }] + : [], + }) as K8sList) + const get = vi.spyOn(client, "get").mockRejectedValue(new Error("not found")) renderWithK8sProvider( , - { client: makeClient(), initialRoute: "/observability/logs" }, + { client, initialRoute: "/observability/logs" }, ) - expect(await screen.findByText("Loading…")).toBeInTheDocument() + expect(await screen.findByText(/^Application/)).toHaveTextContent("Application logs not found.") + expect(get).toHaveBeenCalledWith(expect.anything(), expect.anything(), "observability", "logs", expect.anything()) expect(screen.queryByText(/^Every application in/)).toBeNull() }) })