test: add streamed-output-evaluator unit tests

22 tests covering all code paths: success/error forwarding,
Claude banner detection (usage-exhausted, auth-expired), duplicate
trigger suppression, auth error suppression, null-result tracking,
fallback/rotation trigger dispatch, and state immutability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eyejoker
2026-03-25 12:40:33 +09:00
parent fc85fece0f
commit 61786cacbf
2 changed files with 389 additions and 2 deletions

View File

@@ -535,7 +535,10 @@ export async function startUnifiedDashboard(
// Codex service: fetch own usage and expose via status snapshot.
// Active account every usageUpdateInterval; full scan on startup + hourly.
// Collector returns data; we own the cache state.
const applyRefresh = (result: { rows: UsageRow[]; fetchedAt: string | null }) => {
const applyRefresh = (result: {
rows: UsageRow[];
fetchedAt: string | null;
}) => {
cachedCodexUsageRows = result.rows;
if (result.fetchedAt) codexUsageFetchedAt = result.fetchedAt;
};
@@ -543,7 +546,10 @@ export async function startUnifiedDashboard(
applyRefresh(r);
return refreshActiveCodexUsage().then(applyRefresh);
});
setInterval(() => void refreshActiveCodexUsage().then(applyRefresh), opts.usageUpdateInterval);
setInterval(
() => void refreshActiveCodexUsage().then(applyRefresh),
opts.usageUpdateInterval,
);
setInterval(
() => void refreshAllCodexAccountUsage().then(applyRefresh),
CODEX_FULL_SCAN_INTERVAL,