Files
Portfolio-Codex/tests/navbar.test.ps1
2026-02-04 16:58:07 +01:00

30 lines
1.1 KiB
PowerShell

$ErrorActionPreference = 'Stop'
function Assert-True {
param(
[bool]$Condition,
[string]$Message
)
if (-not $Condition) { throw $Message }
}
Assert-True (Test-Path 'templates/navbar.php') 'Missing templates/navbar.php'
$navbar = Get-Content -Raw 'templates/navbar.php'
Assert-True ($navbar -match 'mobile-menu-toggle') 'Navbar missing toggle id'
Assert-True ($navbar -match 'nav-link-active') 'Navbar missing active class'
Assert-True (Test-Path 'assets/js/main.js') 'Missing assets/js/main.js'
$js = Get-Content -Raw 'assets/js/main.js'
Assert-True ($js -match 'initMobileMenu') 'Missing initMobileMenu'
Assert-True ($js -match 'initNavbarScroll') 'Missing initNavbarScroll'
Assert-True (Test-Path 'index.php') 'Missing index.php'
$index = Get-Content -Raw 'index.php'
if (-not ($index -match "include_template\('navbar'")) {
Assert-True (Test-Path 'pages/home.php') 'Missing pages/home.php for navbar include'
$homeContent = Get-Content -Raw 'pages/home.php'
Assert-True ($homeContent -match "include_template\('navbar'") 'pages/home.php missing navbar include'
}
'OK'