feat: implement ScanTerminalDashboard UI and state management with supporting tests

This commit is contained in:
2569718930@qq.com
2026-05-15 15:02:15 +08:00
parent 747c8aa401
commit 5e8548999a
4 changed files with 96 additions and 14 deletions
@@ -21,4 +21,24 @@ export function runTests() {
),
"deep-analysis refresh must not let sparse incoming hourly data overwrite chart-capable cached hourly data",
);
assert(
source.includes("function pickRicherObservationSeries"),
"city detail merge should preserve chart observation series when refresh payload is sparse",
);
assert(
/metar_today_obs:\s*pickRicherObservationSeries\(\s*current\.metar_today_obs,\s*incoming\.metar_today_obs,?\s*\)/.test(
source,
),
"deep-analysis refresh must not wipe METAR observation points used by the intraday path chart",
);
assert(
/settlement_today_obs:\s*pickRicherObservationSeries\(\s*current\.settlement_today_obs,\s*incoming\.settlement_today_obs,?\s*\)/.test(
source,
),
"deep-analysis refresh must not wipe settlement observation points used by the intraday path chart",
);
assert(
/trend:\s*mergeTrendInfo\(\s*current\.trend,\s*incoming\.trend\s*\)/.test(source),
"deep-analysis refresh must merge trend.recent instead of replacing it with sparse trend payloads",
);
}
@@ -7,6 +7,12 @@ function assert(condition: unknown, message: string) {
export function runTests() {
const projectRoot = process.cwd();
const dashboardPath = path.join(
projectRoot,
"components",
"dashboard",
"ScanTerminalDashboard.tsx",
);
const bannerPath = path.join(
projectRoot,
"components",
@@ -14,6 +20,7 @@ export function runTests() {
"scan-terminal",
"MarketOverviewBanner.tsx",
);
const dashboardSource = fs.readFileSync(dashboardPath, "utf8");
const source = fs.readFileSync(bannerPath, "utf8");
assert(
@@ -22,4 +29,8 @@ export function runTests() {
!source.includes("styles.badge"),
"market overview banner should not render the AI overview badge",
);
assert(
!dashboardSource.includes("MarketOverviewBanner"),
"scan terminal dashboard should not mount the AI market overview banner",
);
}