Skip to content

Commit 810b994

Browse files
authored
test(ui): remove source-mirror assertions (#121266)
1 parent 0efd5b4 commit 810b994

2 files changed

Lines changed: 1 addition & 44 deletions

File tree

‎ui/src/app/service-worker-cache.test.ts‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,6 @@ const here = path.dirname(fileURLToPath(import.meta.url));
1010
const serviceWorkerPath = path.join(here, "../../public/sw.js");
1111

1212
describe("Control UI service worker cache versioning", () => {
13-
it("registers the service worker with a build id and bounds prior build caches", () => {
14-
const mainSource = fs.readFileSync(path.join(here, "../main.ts"), "utf8");
15-
const serviceWorkerSource = fs.readFileSync(serviceWorkerPath, "utf8");
16-
const viteConfigSource = fs.readFileSync(path.join(here, "../../vite.config.ts"), "utf8");
17-
18-
expect(mainSource).toContain('swUrl.searchParams.set("v"');
19-
expect(mainSource).toContain("CONTROL_UI_BUILD_INFO.buildId");
20-
expect(mainSource).toContain('updateViaCache: "none"');
21-
expect(mainSource).toContain('navigator.serviceWorker.addEventListener("message"');
22-
expect(mainSource).toContain("event.data.version !== currentControlUiBuildId");
23-
expect(serviceWorkerSource).toContain(
24-
'const EMBEDDED_CACHE_VERSION = "__OPENCLAW_CONTROL_UI_BUILD_ID__"',
25-
);
26-
expect(serviceWorkerSource).toContain("URL_CACHE_VERSION");
27-
expect(serviceWorkerSource).toContain("CONTROL_CACHE_LIMIT = 3");
28-
expect(serviceWorkerSource).toContain("slice(-priorCacheLimit)");
29-
expect(serviceWorkerSource).toContain("caches.delete");
30-
expect(serviceWorkerSource).toContain("includeUncontrolled: true");
31-
expect(serviceWorkerSource).not.toContain(
32-
'postMessage({ type: "sw-updated", version: CACHE_VERSION },',
33-
);
34-
expect(viteConfigSource).toContain("source.replace(placeholder, JSON.stringify(buildId))");
35-
expect(viteConfigSource).toContain(
36-
'"globalThis.OPENCLAW_CONTROL_UI_BUILD_INFO": JSON.stringify(buildInfo)',
37-
);
38-
expect(viteConfigSource).not.toContain(
39-
"OPENCLAW_CONTROL_UI_BUILD_ID: JSON.stringify(controlUiBuildId)",
40-
);
41-
expect(serviceWorkerSource).not.toContain('const CACHE_NAME = "openclaw-control-v1"');
42-
});
43-
4413
it("broadcasts updated versions to uncontrolled window clients during activation", async () => {
4514
const serviceWorkerSource = fs.readFileSync(serviceWorkerPath, "utf8");
4615
const windowClient = { postMessage: vi.fn() };

‎ui/src/pages/chat/realtime-talk-shared.browser-import.test.ts‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,10 @@
22
import { readFile } from "node:fs/promises";
33
import { describe, expect, it } from "vitest";
44

5-
function importLines(source: string): string[] {
6-
return source
7-
.split(/\r?\n/u)
8-
.filter((line) => line.startsWith("import "))
9-
.map((line) => line.trim());
10-
}
11-
125
describe("realtime talk shared browser imports", () => {
136
it("keeps embedded run-control runtime out of the Control UI import path", async () => {
147
const source = await readFile(new URL("./realtime-talk-shared.ts", import.meta.url), "utf8");
15-
const imports = importLines(source);
168

17-
expect(imports).toContain(
18-
'import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME } from "../../../../src/talk/agent-consult-tool.js";',
19-
);
20-
expect(source).toContain('from "../../../../src/talk/agent-run-control-shared.js";');
21-
expect(imports.some((line) => line.includes("agent-run-control.js"))).toBe(false);
9+
expect(source).not.toMatch(/\bfrom\s+["'][^"']*\/agent-run-control\.js["']/u);
2210
});
2311
});

0 commit comments

Comments
 (0)