from __future__ import annotations import unittest from pathlib import Path class ReleaseMetadataParityTests(unittest.TestCase): def test_powershell_release_package_emits_archive_path_alias(self) -> None: repo_root = Path(__file__).resolve().parents[2] script_text = (repo_root / "package_domain_release.ps1").read_text(encoding="utf-8") self.assertIn("archive_path = $zipPath", script_text) self.assertIn('"archive_path=$zipPath"', script_text) def test_powershell_release_flow_prefers_archive_path_with_zip_fallback(self) -> None: repo_root = Path(__file__).resolve().parents[2] prepare_text = (repo_root / "prepare_final_release.ps1").read_text(encoding="utf-8") show_text = (repo_root / "show_latest_release.ps1").read_text(encoding="utf-8") self.assertIn("$archivePath = if ($latest.archive_path) { $latest.archive_path } else { $latest.zip_path }", prepare_text) self.assertIn('& (Join-Path $root "package_domain_release.ps1")', prepare_text) self.assertIn('& (Join-Path $root "verify_domain_release.ps1")', prepare_text) self.assertNotIn('powershell -ExecutionPolicy Bypass -File (Join-Path $root "package_domain_release.ps1")', prepare_text) self.assertIn("$reportArchivePath = if ($report.latest_release.archive_path) { [string]$report.latest_release.archive_path } else { [string]$report.latest_release.zip_path }", show_text) self.assertIn("$latestArchivePath = if ($latest.archive_path) { [string]$latest.archive_path } else { [string]$latest.zip_path }", show_text) if __name__ == "__main__": unittest.main()