diff --git a/tests/auth-page-shell-contract.ps1 b/tests/auth-page-shell-contract.ps1 new file mode 100644 index 0000000..78768f4 --- /dev/null +++ b/tests/auth-page-shell-contract.ps1 @@ -0,0 +1,40 @@ +$ErrorActionPreference = 'Stop' + +function Assert-Contains { + param([string]$Content, [string]$Expected, [string]$Message) + if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message } +} + +function Assert-NotContains { + param([string]$Content, [string]$Unexpected, [string]$Message) + if ($Content -match [regex]::Escape($Unexpected)) { throw $Message } +} + +$root = Split-Path -Parent $PSScriptRoot +$shellPath = Join-Path $root 'components/AuthPageShell.vue' +if (-not (Test-Path -LiteralPath $shellPath)) { throw 'AuthPageShell is missing' } + +$shell = Get-Content -LiteralPath $shellPath -Raw -Encoding utf8 +foreach ($required in @( + 'class="auth-shell__header"', + 'class="auth-shell__header-image"', + 'a01-vnext-header-v1.png', + 'mode="widthFix"', + 'class="auth-shell__paper"', + 'auth-page-paper.jpg', + '', + '', + 'min-height: var(--app-viewport-height);' +)) { + Assert-Contains -Content $shell -Expected $required -Message "AuthPageShell is missing: $required" +} + +foreach ($pageName in @('a01-entry.vue', 'a04-register.vue', 'a05-reset-password.vue', 'a06-auth-status.vue')) { + $page = Get-Content -LiteralPath (Join-Path $root "pages/auth/$pageName") -Raw -Encoding utf8 + Assert-Contains -Content $page -Expected '