mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
* perf(client): reduce redundant summary and polling API calls - summary cache capacity 32→128 to eliminate eviction-driven re-fetches - IntelligenceGapBadge: skip polling when tab not visible - McpConnectModal: raise min refresh interval 10→60s * fix(tests): replace eval(), harden regexes, extract MCP refresh constant - Replace eval() in summary-cache-capacity test with regex assertion - Scope persistCache test to summaryResultBreaker block - Harden intelligence-gap-badge regex: [^}]* → [\s\S]*? (nested braces) - Extract MIN_MCP_REFRESH_S constant in McpConnectModal (DRY) - Update mcp-connect-modal test to verify constant usage --------- Co-authored-by: Elie Habib <elie.habib@gmail.com>
19 lines
706 B
TypeScript
19 lines
706 B
TypeScript
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { resolve, dirname } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const src = readFileSync(resolve(__dirname, '..', 'src', 'components', 'IntelligenceGapBadge.ts'), 'utf-8');
|
|
|
|
describe('IntelligenceGapBadge polling', () => {
|
|
it('setInterval callback includes visibilityState check', () => {
|
|
assert.match(
|
|
src,
|
|
/setInterval\(\s*\(\)\s*=>\s*\{[\s\S]*?visibilityState/s,
|
|
'setInterval callback must check document.visibilityState to avoid background-tab polling',
|
|
);
|
|
});
|
|
});
|