mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-12 11:10:19 +08:00
- 修复 darwin/arm64 构建中 tsc 无法解析 node:assert 的 TS2307 报错 - 将 dataGridLayout.test.ts 中的 node:assert 替换为本地 assertEqual - 将 redisViewerWorkbenchTheme.test.ts 中的 node:assert 替换为本地断言函数 - 将 overlayWorkbenchTheme.test.ts 中的 node:assert 替换为本地断言函数 - 保持原有断言语义不变,避免引入新的运行时依赖 - 本地验证 npm --prefix frontend run build 通过
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
import { buildOverlayWorkbenchTheme } from './overlayWorkbenchTheme';
|
|
|
|
const assertEqual = (actual: unknown, expected: unknown, message: string) => {
|
|
if (actual !== expected) {
|
|
throw new Error(`${message}\nactual: ${String(actual)}\nexpected: ${String(expected)}`);
|
|
}
|
|
};
|
|
|
|
const assertMatch = (value: string, pattern: RegExp, message: string) => {
|
|
if (!pattern.test(value)) {
|
|
throw new Error(`${message}\nactual: ${value}\npattern: ${String(pattern)}`);
|
|
}
|
|
};
|
|
|
|
const darkTheme = buildOverlayWorkbenchTheme(true);
|
|
assertEqual(darkTheme.isDark, true, 'dark 主题标记应为 true');
|
|
assertMatch(darkTheme.shellBg, /rgba\(15, 15, 17,/, 'dark 弹层背景应保持中性黑');
|
|
assertMatch(darkTheme.sectionBg, /rgba\(255,?\s*255,?\s*255,?\s*0\.03\)/, 'dark section 背景透明度应匹配');
|
|
assertEqual(darkTheme.iconColor, '#ffd666', 'dark 图标色应为金色强调');
|
|
|
|
const lightTheme = buildOverlayWorkbenchTheme(false);
|
|
assertEqual(lightTheme.isDark, false, 'light 主题标记应为 false');
|
|
assertMatch(lightTheme.shellBg, /rgba\(255,255,255,0\.98\)/, 'light 弹层背景透明度应匹配');
|
|
assertMatch(lightTheme.sectionBg, /rgba\(255,?\s*255,?\s*255,?\s*0\.84\)/, 'light section 背景透明度应匹配');
|
|
assertEqual(lightTheme.iconColor, '#1677ff', 'light 图标色应为蓝色强调');
|
|
|
|
console.log('overlayWorkbenchTheme tests passed');
|