From 8ffb97cdd204904d0b6ba65a4053ad2cb83d8494 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 12 Aug 2026 16:26:36 -0700 Subject: [PATCH] test(ui): remove duplicate stale recovery case (#122860) --- .../plugin/plugin-page.lazy-load.test.ts | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/ui/src/pages/plugin/plugin-page.lazy-load.test.ts b/ui/src/pages/plugin/plugin-page.lazy-load.test.ts index a31d8f45ce57..006e4147642d 100644 --- a/ui/src/pages/plugin/plugin-page.lazy-load.test.ts +++ b/ui/src/pages/plugin/plugin-page.lazy-load.test.ts @@ -2,8 +2,6 @@ import { describe, expect, it, vi } from "vitest"; import type { GatewayHelloOk } from "../../api/gateway.ts"; import type { RouteId } from "../../app-route-paths.ts"; import type { ApplicationContext, ApplicationGatewaySnapshot } from "../../app/context.ts"; -import { scheduleStaleChunkReload } from "../../app/stale-chunk-reload.ts"; -import { CONTROL_UI_BUILD_INFO } from "../../build-info.ts"; import { waitForFast } from "../../test-helpers/wait-for.ts"; import { PluginPage } from "./plugin-page.ts"; @@ -95,46 +93,6 @@ describe("PluginPage bundled view load failures", () => { } }); - it("keeps stale recovery visible after this build already reloaded automatically", async () => { - const failedLoad = deferred(); - const values = new Map(); - const storage = { - getItem: (key: string) => values.get(key) ?? null, - setItem: (key: string, value: string) => void values.set(key, value), - }; - vi.spyOn(window, "sessionStorage", "get").mockReturnValue(storage as Storage); - const fetchMock = vi.fn(async () => new Response(null, { status: 200 })); - vi.stubGlobal("fetch", fetchMock); - await scheduleStaleChunkReload({ - buildId: CONTROL_UI_BUILD_INFO.buildId, - now: () => Date.now() - 6_000, - reload: vi.fn(), - storage, - }); - fetchMock.mockClear(); - const page = createPage([failedLoad.promise]); - document.body.append(page); - try { - await waitForFast(() => expect(page.querySelector('[role="status"]')).not.toBeNull()); - failedLoad.reject(new Error("Failed to fetch dynamically imported module")); - await waitForFast(() => - expect(page.querySelector('[role="alert"]')?.textContent).toContain( - "Failed to fetch dynamically imported module", - ), - ); - - await Promise.resolve(); - await page.updateComplete; - - expect(fetchMock).not.toHaveBeenCalled(); - expect(page.querySelector('[role="alert"]')).not.toBeNull(); - } finally { - page.remove(); - vi.unstubAllGlobals(); - vi.restoreAllMocks(); - } - }); - it("ignores a stale rejection after switching away and back", async () => { const staleLoad = deferred(); const currentLoad = deferred();