Files
Netcatty/components/terminalLayer/useTerminalLayerEffects.test.ts
T
bincxzandCursor eee7a8846c Unify terminal theme updates through ThemeRuntime for faster, synced UI.
Replace parallel preview/pending follow-app pipelines with a single runtime
that drives xterm, side panel, host tree, and top tabs together in both
follow-app and manual modes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 02:17:06 +08:00

28 lines
1.4 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
const source = readFileSync(new URL("./useTerminalLayerEffects.ts", import.meta.url), "utf8");
test("theme preview DOM effects were removed in favor of ThemeRuntime injection", () => {
assert.doesNotMatch(source, /themePreview/);
assert.doesNotMatch(source, /applyTerminalPreviewVars/);
assert.doesNotMatch(source, /clearHostTreePreviewVars/);
assert.doesNotMatch(source, /applyTopTabsPreviewVars/);
assert.doesNotMatch(source, /themeCommitTimerRef/);
});
test("terminal activity filter consumes chunks before activity guards", () => {
const subscriptionIndex = source.indexOf("return onSessionData(session.id, (chunk) => {");
const filterIndex = source.indexOf("const hasNotifiableOutput = hasNotifiableTerminalOutput(filter, chunk);", subscriptionIndex);
const visibleGuardIndex = source.indexOf("if (!shouldMarkSessionActivity(activeTabIdRef.current, session))", subscriptionIndex);
const alreadyActiveGuardIndex = source.indexOf("if (sessionActivityStore.getSnapshot()[session.id])", subscriptionIndex);
assert.notEqual(subscriptionIndex, -1);
assert.notEqual(filterIndex, -1);
assert.notEqual(visibleGuardIndex, -1);
assert.notEqual(alreadyActiveGuardIndex, -1);
assert.ok(filterIndex < visibleGuardIndex);
assert.ok(filterIndex < alreadyActiveGuardIndex);
});