"""UI-контракт analytics на /reports и /feed_consumption.""" from __future__ import annotations import unittest from tests.helpers.zootech_test_helpers import STATIC class AnalyticsUiContractTests(unittest.TestCase): @classmethod def setUpClass(cls) -> None: cls.reports_html = (STATIC / "reports.html").read_text(encoding="utf-8") cls.consumption_html = (STATIC / "consumption.html").read_text(encoding="utf-8") cls.copy_js = (STATIC / "js" / "pages" / "analytics-copy.js").read_text(encoding="utf-8") def test_reports_has_analytics_tabs(self) -> None: self.assertIn('data-reports-view-tab="summary"', self.reports_html) self.assertIn('data-reports-view-tab="comparison"', self.reports_html) self.assertIn('data-reports-view-tab="journal"', self.reports_html) self.assertIn('data-journal-view-tab="alerts"', self.reports_html) self.assertIn("analytics-summary.js", self.reports_html) self.assertIn("analytics-plan-fact.js", self.reports_html) def test_consumption_has_stock_forecast(self) -> None: self.assertIn("stockForecastBanner", self.consumption_html) self.assertIn("stock-forecast.js", self.consumption_html) self.assertIn("data-stock-days-adjusted", self.consumption_html) def test_copy_uses_zootech_labels(self) -> None: self.assertIn("Перерасход", self.copy_js) self.assertIn("Недогруз", self.copy_js) self.assertIn("По рецепту", self.copy_js) if __name__ == "__main__": unittest.main()