Files
jiapuapp/tests/t01-person-action-panel-contract.ps1
T
2026-07-24 07:56:33 +08:00

50 lines
1.3 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$page = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t01-tree-overview.vue') -Raw -Encoding UTF8
$routes = Get-Content -LiteralPath (Join-Path $root 'utils/navigation-routes.js') -Raw -Encoding UTF8
foreach ($required in @(
'class="member-node__avatar"',
'const memberActionPanelVisible = ref(false)',
'const memberActions = Object.freeze([',
'const openMemberAction = (action) =>',
'<AppDialog',
'member-action-grid',
'unavailableActionVisible',
'BIND_INVITE'
)) {
if (-not $page.Contains($required)) {
throw "T01 member action panel missing: $required"
}
}
foreach ($actionKey in @(
'VIEW_PROFILE',
'ADD_FATHER',
'ADD_MOTHER',
'ADD_SPOUSE',
'ADD_SIBLING',
'ADJUST_RANK',
'ADD_SON',
'ADD_DAUGHTER',
'BIND_INVITE',
'EDIT_PROFILE'
)) {
if (-not $page.Contains(('key: "' + $actionKey + '"'))) {
throw "T01 member action panel missing action: $actionKey"
}
}
foreach ($required in @(
'optionalParams: ["personId", "mode", "relationType"]',
'allowedSources: ["T01", "T03"]',
'optionalParams: ["mode"]'
)) {
if (-not $routes.Contains($required)) {
throw "T01 member action route contract missing: $required"
}
}
Write-Output 'T01-PERSON-ACTION-PANEL-CONTRACT PASS'