Files
jiapuapp/tests/g01-role-shortcut-contract.ps1
T
2026-07-23 17:21:33 +08:00

18 lines
959 B
PowerShell

$ErrorActionPreference = 'Stop'
$page = Get-Content -Raw 'pages/genealogy/g01-my-genealogies.vue'
function Assert-Contains([string]$Content, [string]$Pattern, [string]$Message) {
if (-not $Content.Contains($Pattern)) { throw $Message }
}
Assert-Contains $page 'v-for="item in visibleShortcuts"' 'G01 must render the membership-filtered shortcut list'
Assert-Contains $page '{{ currentRoleLabel }}' 'G01 must render the membership-derived role label'
Assert-Contains $page 'currentGenealogy.value?.accessRole === "owner"' 'G01 must consume the normalized remote role'
Assert-Contains $page 'item.key !== "applications"' 'G01 must remove application review for joined members'
$selectedBinding = ':selected="item.id === currentGenealogy.id"'
if (([regex]::Matches($page, [regex]::Escape($selectedBinding))).Count -ne 2) {
throw 'G01 created and joined groups must render the same current-genealogy state'
}
Write-Output 'G01-ROLE-SHORTCUT-CONTRACT PASS'