Refresh terminal charts on activation
This commit is contained in:
@@ -108,6 +108,20 @@ export async function runTests() {
|
||||
dashboardSource.includes('activeNavKey !== "thresholds"'),
|
||||
"terminal screen should preload the chart chunk once access is confirmed on the chart tab",
|
||||
);
|
||||
assert(
|
||||
dashboardSource.includes("terminalActivationRefreshKey") &&
|
||||
dashboardSource.includes("setTerminalActivationRefreshKey") &&
|
||||
querySource.includes("terminalActivationRefreshKey") &&
|
||||
querySource.includes("handleTerminalActivationRefresh") &&
|
||||
querySource.includes("fetchScanTerminal({ forceRefresh: false, showLoading: false })"),
|
||||
"switching back to the terminal tab should trigger a lightweight scan refresh without waiting for browser focus events",
|
||||
);
|
||||
assert(
|
||||
chartSource.includes("activationRefreshKey") &&
|
||||
chartSource.includes("refreshActivatedCachedDetail") &&
|
||||
chartSource.includes("fetchHourlyForecastForCity(city, { bypassLocalCache: true, resolution: targetResolution })"),
|
||||
"switching back to the terminal tab should refresh visible chart detail through cached backend data without forcing external sources",
|
||||
);
|
||||
assert(
|
||||
chartSource.includes("fetchHourlyForecastForCity(city, { ignoreCache: true, resolution: targetResolution })") &&
|
||||
chartSource.includes("setHourly((prev) => mergeHourlyWithLiveObservations(dataWithCurrentRow, prev, row))"),
|
||||
|
||||
@@ -249,11 +249,12 @@ export function runTests() {
|
||||
);
|
||||
const foregroundRefreshBlock = chart.match(/const refreshForegroundFullDetail = \(\) => \{[\s\S]*?\n \};/)?.[0] || "";
|
||||
assert(
|
||||
foregroundRefreshBlock.includes("ignoreCache: true") &&
|
||||
foregroundRefreshBlock.includes("fetchHourlyForecastForCity") &&
|
||||
foregroundRefreshBlock.includes("FOREGROUND_FULL_DETAIL_REFRESH_DEDUP_MS") &&
|
||||
!foregroundRefreshBlock.includes("setIsHourlyLoading(true)"),
|
||||
"foreground resume refresh should update full detail in the background without showing the loading overlay or refetching fresh detail",
|
||||
foregroundRefreshBlock.includes("bypassLocalCache: true") &&
|
||||
foregroundRefreshBlock.includes("fetchHourlyForecastForCity") &&
|
||||
foregroundRefreshBlock.includes("FOREGROUND_FULL_DETAIL_REFRESH_DEDUP_MS") &&
|
||||
!foregroundRefreshBlock.includes("ignoreCache: true") &&
|
||||
!foregroundRefreshBlock.includes("setIsHourlyLoading(true)"),
|
||||
"foreground resume refresh should revalidate cached detail in the background without showing the loading overlay or forcing external sources",
|
||||
);
|
||||
assert(
|
||||
!chart.includes("/api/city/${encodeURIComponent(city)}/summary"),
|
||||
|
||||
Reference in New Issue
Block a user