Files
PolyWeather/frontend/components/dashboard/scan-terminal/__tests__/removedMonitorRunwayTabs.test.ts
T
2569718930@qq.com 02fd7d9e49 修复 CI: 适配 MobileCityPicker 测试断言 + 清理 f-string 和无用 import
- removedMonitorRunwayTabs.test.ts: 检查 MobileCityPicker 替代旧 scan-mobile-city-list-view
- stableServerRefreshPolicy.test.ts: 同上,MobileCityPicker 替代旧视图标识
- scan_forum_topics.py: 移除无占位符的 f-string 和无用 json import
2026-05-17 18:08:59 +08:00

61 lines
1.8 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
function assert(condition: unknown, message: string) {
if (!condition) throw new Error(message);
}
export function runTests() {
const projectRoot = process.cwd();
const shellPartsPath = path.join(
projectRoot,
"components",
"dashboard",
"scan-terminal",
"ScanTerminalShellParts.tsx",
);
const dashboardPath = path.join(
projectRoot,
"components",
"dashboard",
"ScanTerminalDashboard.tsx",
);
const runwayPanelPath = path.join(
projectRoot,
"components",
"dashboard",
"scan-terminal",
"RunwayObservationsPanel.tsx",
);
const monitorPanelPath = path.join(
projectRoot,
"components",
"dashboard",
"monitoring",
"MonitorPanel.tsx",
);
const shellPartsSource = fs.readFileSync(shellPartsPath, "utf8");
const dashboardSource = fs.readFileSync(dashboardPath, "utf8");
assert(
!shellPartsSource.includes('"monitor"') && !shellPartsSource.includes('"runway"'),
"scan terminal content views must not include market monitor or runway tabs",
);
assert(
shellPartsSource.includes('"city-list"') &&
dashboardSource.includes("MobileCityPicker") &&
dashboardSource.includes('setActiveView("city-list")'),
"mobile web should expose the city-list view via MobileCityPicker",
);
assert(
!dashboardSource.includes('setActiveView("monitor")') &&
!dashboardSource.includes('setActiveView("runway")') &&
!dashboardSource.includes("市场监控") &&
!dashboardSource.includes("跑道观测"),
"dashboard must not expose market monitor or runway observation tabs",
);
assert(!fs.existsSync(runwayPanelPath), "dedicated runway observation panel must be removed");
assert(!fs.existsSync(monitorPanelPath), "dedicated market monitor panel must be removed");
}