"""Dashboard owner delete uses a confirm dialog, not window.confirm.""" from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[1] BTN = ( ROOT / "periscope" / "src" / "frontend" / "src" / "components" / "dashboard" / "delete-project-button.tsx" ) CARD = ( ROOT / "periscope" / "src" / "frontend" / "src" / "components" / "dashboard" / "project-card.tsx" ) TABLE = ( ROOT / "periscope" / "src" / "frontend" / "src" / "components" / "dashboard" / "projects-table.tsx" ) API = ROOT / "periscope" / "src" / "frontend" / "src" / "lib" / "api.ts" def test_delete_dialog_is_src_and_owner_only_copy(): text = BTN.read_text(encoding="utf-8") assert "Native Periscope overlay" not in text[:400] assert "export function DeleteProjectButton" in text assert "AlertDialog" in text assert "deleteProject" in text assert "window.confirm" not in text assert "confirm(`" not in text def test_dashboard_cards_and_table_use_delete_dialog(): card = CARD.read_text(encoding="utf-8") table = TABLE.read_text(encoding="utf-8") assert "DeleteProjectButton" in card assert "DeleteProjectButton" in table assert "confirm(" not in card assert "confirm(" not in table assert "!foreign" in card assert "!foreign" in table def test_api_delete_is_http_delete(): text = API.read_text(encoding="utf-8") assert "export async function deleteProject" in text assert 'method: "DELETE"' in text