Files
jiapuapp/tests/m01-module-baseline-contract.ps1
T
2026-07-29 18:16:08 +08:00

63 lines
1.7 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$source = Get-Content 'pages/profile/m01-profile-home.vue' -Raw -Encoding UTF8
foreach ($required in @(
'profile-state--ready',
'profile-state--error',
'm01-profile-archive-hero-v2.png',
'm01-profile-tree-medallion.png',
'class="profile-hero__art"',
'class="profile-hero__content"',
'class="profile-metadata"',
'class="profile-service-row"',
'grid-area: 1 / 1',
'height: 503rpx',
'height: 480rpx',
'white-space: nowrap',
'pointer-events: none',
'AppButton',
'AppTabbar',
'routeKey: "M03"',
'routeKey: "N01"',
'routeKey: "M06"',
'routeKey: "M08"',
'routeKey: "M09"',
'routeKey: "M10"',
'openPage("M02", {}, "M01")',
'openPage(item.routeKey, {}, "M01")'
)) {
if (-not $source.Contains($required)) {
throw "M01 missing archive redesign contract: $required"
}
}
foreach ($forbidden in @(
'auth-divider-knot.png',
'root-header-hall.png',
'm01-profile-notice-card.png',
'm01-profile-menu-frame.png',
'uni.navigateTo',
'uni.navigateBack',
'uni.redirectTo',
'uni.reLaunch',
'getCurrentPages(',
'<navigator',
'/pages/'
)) {
if ($source.Contains($forbidden)) {
throw "M01 must not retain obsolete navigation or separate-decoration contract: $forbidden"
}
}
if ($source -notmatch '(?s)\.profile-hero__identity\s*\{[^}]*position\s*:\s*relative\s*;' -or
$source -notmatch '(?s)\.profile-hero__edit\s*\{[^}]*position\s*:\s*absolute\s*;') {
throw 'M01 archive redesign must anchor the edit action to the hero identity block'
}
if ($source -match '\.profile-page\s*:deep\(\.app-tabbar\)|\.profile-page\s*:deep\(\.tab-label\)') {
throw 'M01 must preserve the shared AppTabbar appearance'
}
Write-Output 'M01-MODULE-BASELINE-CONTRACT PASS'