mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 18:16:32 +00:00
23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const appSource = readFileSync(new URL("../../App.tsx", import.meta.url), "utf8");
|
|
const appViewSource = readFileSync(new URL("./AppView.tsx", import.meta.url), "utf8");
|
|
|
|
test("follow-app terminal theme selection updates the matching UI theme", () => {
|
|
assert.match(appSource, /const update = getFollowAppTerminalThemeSelectionUpdate\(themeId\)/);
|
|
assert.match(appSource, /setDarkUiThemeId\(update\.uiThemeId\)/);
|
|
assert.match(appSource, /setLightUiThemeId\(update\.uiThemeId\)/);
|
|
assert.match(appSource, /setTheme\(update\.appTheme\)/);
|
|
assert.doesNotMatch(appSource, /customThemeStore\.getThemeById\(themeId\)/);
|
|
});
|
|
|
|
test("default terminal theme selection clears the current mode override", () => {
|
|
assert.match(appSource, /const handleDefaultTerminalThemeChange = useCallback\(\(themeId: string\) => \{/);
|
|
assert.match(appSource, /setTerminalThemeId\(themeId\)/);
|
|
assert.match(appSource, /resolvedTheme === 'dark'[\s\S]*setTerminalThemeDarkId\(TERMINAL_THEME_AUTO\)/);
|
|
assert.match(appSource, /setTerminalThemeLightId\(TERMINAL_THEME_AUTO\)/);
|
|
assert.match(appViewSource, /onUpdateTerminalThemeId=\{handleDefaultTerminalThemeChange\}/);
|
|
});
|