"""UI-контракт /reports.""" from __future__ import annotations import unittest from tests.helpers.zootech_test_helpers import STATIC class ReportsUiContractTests(unittest.TestCase): def setUp(self) -> None: self.html = (STATIC / "reports.html").read_text(encoding="utf-8") def test_fetches_reports_with_date_params(self) -> None: self.assertIn("date_from", self.html) self.assertIn("/api/reports", self.html) def test_excel_export_dependency(self) -> None: self.assertIn("xlsx", self.html.lower()) def test_feed_quality_tab_and_scripts(self) -> None: self.assertIn('data-journal-view-tab="alerts"', self.html) self.assertIn("Отклонения", self.html) self.assertIn("open-feed-quality-settings", self.html) self.assertIn("feed-alerts.js", self.html) self.assertIn("analytics-summary.js", self.html) js = (STATIC / "js/pages/feed-alerts.js").read_text(encoding="utf-8") self.assertIn("/api/feed-quality/alerts", js) self.assertIn("deviation-alert-card", js) self.assertIn("zt-card zt-card--interactive", js) css = (STATIC / "css/wesp-reports-page.css").read_text(encoding="utf-8") self.assertIn("deviation-alert-card.list-item", css) self.assertIn("var(--bg-white", css) self.assertIn("deviation-type-badge--error", css) self.assertIn('html[data-theme="dark"] .reports-page .deviation-type-badge--error', css) settings_js = (STATIC / "js/pages/feed-quality-settings-modal.js").read_text( encoding="utf-8" ) self.assertIn("/api/feed-quality/settings", settings_js) self.assertIn("LEFT_IN_MIXER", js) self.assertIn("LOADING_TIME", js) self.assertIn("LOADING_FAST", js) self.assertIn("OVERLOAD", js) if __name__ == "__main__": unittest.main()