"""Frontend Next/ESLint/PostCSS overlay lives under periscope/src.""" from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[1] SRC = ROOT / "periscope" / "src" / "frontend" def test_next_and_eslint_are_src(): for rel in ("next.config.ts", "eslint.config.mjs", "postcss.config.mjs", "tsconfig.json"): path = SRC / rel assert path.is_file(), rel assert "Native Periscope overlay" not in path.read_text(encoding="utf-8")[:400] def test_next_config_keeps_runtime_contract(): text = (SRC / "next.config.ts").read_text(encoding="utf-8") assert 'from "./src/lib/csp-hosts"' in text assert 'allowedDevOrigins: ["127.0.0.1", "localhost"]' in text assert 'serverExternalPackages: ["pdfjs-dist"]' in text assert 'canvas: { browser: "" }' in text assert 'source: "/login"' in text assert 'destination: "/sign-in"' in text assert 'source: "/register"' in text assert 'destination: "/sign-up"' in text assert "X-Content-Type-Options" in text assert "X-Frame-Options" in text assert "Strict-Transport-Security" in text assert "Content-Security-Policy" in text assert "worker-src 'self' blob:" in text assert "pdfjs-dist" in text def test_eslint_uses_next_core_web_vitals(): text = (SRC / "eslint.config.mjs").read_text(encoding="utf-8") assert "eslint-config-next/core-web-vitals" in text assert "eslint-config-next/typescript" in text assert ".next/**" in text