Files
PlantAI-dev/tests/unit/test_frontend_cpu_monitor_contract.py
T

14 lines
531 B
Python
Raw Normal View History

from pathlib import Path
INDEX_HTML = Path(__file__).resolve().parents[2] / "apps" / "web" / "vue3" / "index.html"
def test_cpu_monitor_polls_lightweight_resource_endpoint_independently():
source = INDEX_HTML.read_text(encoding="utf-8")
assert "const refreshResourceUsage = async () =>" in source
assert "fetch('/api/resource/status', { cache: 'no-store' })" in source
assert "resourceMonitorTimer = setInterval(refreshResourceUsage, 1000)" in source
assert "clearInterval(resourceMonitorTimer)" in source