37 lines
2.1 KiB
PowerShell
37 lines
2.1 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
function Assert-Contains {
|
|
param([string]$Content, [string]$Expected, [string]$Message)
|
|
if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message }
|
|
}
|
|
|
|
function Assert-NoCssSurface {
|
|
param([string]$Content, [string]$ClassName)
|
|
foreach ($property in @('border', 'background', 'border-radius')) {
|
|
if ($Content -match "(?s)\\.$ClassName\\s*\\{[^}]*\\b$property\\s*:") { throw "T01 must not construct .$ClassName with CSS $property" }
|
|
}
|
|
}
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
|
|
$paths = @($pages.pages.path)
|
|
$t01 = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t01-tree-overview.vue') -Raw -Encoding utf8
|
|
$t02 = Join-Path $root 'pages/tree/t02-tree-states.vue'
|
|
|
|
if (-not ($paths -contains 'pages/tree/t01-tree-overview')) { throw 'T01 route missing' }
|
|
if ($paths -contains 'pages/tree/t02-tree-states') { throw 'T02 route must be removed; tree states belong to T01' }
|
|
if (Test-Path -LiteralPath $t02) { throw 'T02 page file must be deleted; tree states belong to T01' }
|
|
if ($paths.Count -ne 54) { throw "Expected 54 routes after the approved T02-to-T01 state merge, found $($paths.Count)." }
|
|
|
|
foreach ($required in @("const treeState = ref('loading')", "'tree'", "'landscape'", "'empty'", "'error'", 't01-tree-canvas.png', 't01-member-node.png', 't01-member-sheet.png', 'tree-state--landscape', 'tree-state--empty', 'tree-state--error', '/pages/tree/t03-member-profile?genealogyId=', '/pages/tree/t04-add-relative?genealogyId=')) {
|
|
Assert-Contains -Content $t01 -Expected $required -Message "Missing T01 tree-state contract: $required"
|
|
}
|
|
|
|
foreach ($className in @('tree-canvas', 'member-node', 'member-sheet')) { Assert-NoCssSurface -Content $t01 -ClassName $className }
|
|
|
|
foreach ($asset in @('t01-tree-canvas.png', 't01-member-node.png', 't01-member-sheet.png')) {
|
|
if (-not (Test-Path -LiteralPath (Join-Path $root "static/assets/modules/tree/opaque/$asset"))) { throw "T01 requires final opaque asset: $asset" }
|
|
}
|
|
|
|
Write-Output 'T01-TREE-STATE-CONTRACT PASS'
|