27 lines
1.6 KiB
PowerShell
27 lines
1.6 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$list = Get-Content -LiteralPath (Join-Path $root 'pages/notification/n01-message-center.vue') -Raw -Encoding UTF8
|
|
$detail = Get-Content -LiteralPath (Join-Path $root 'pages/notification/n02-message-detail.vue') -Raw -Encoding UTF8
|
|
$api = Get-Content -LiteralPath (Join-Path $root 'utils/api.js') -Raw -Encoding UTF8
|
|
|
|
foreach ($token in @('appApi.getNotifications', 'notifications.length', 'createRequestController', 'isRequestCancelled')) {
|
|
if (-not $list.Contains($token)) { throw "N01 notification list contract missing: $token" }
|
|
}
|
|
foreach ($token in @('appApi.getNotificationDetail', 'notificationId.value', 'createRequestController', 'onLoad((options)', 'controller.abort()', 'returnTo("N01")')) {
|
|
if (-not $detail.Contains($token)) { throw "N02 notification detail contract missing: $token" }
|
|
}
|
|
foreach ($token in @('normalizeNotificationDetail', 'NOTIFICATION_DETAIL_RESPONSE_INVALID', 'async getNotificationDetail', 'url: `/genealogy/app/notifications/${normalizedNotificationId}`', "method: 'GET'")) {
|
|
if (-not $api.Contains($token)) { throw "Notification API contract missing: $token" }
|
|
}
|
|
|
|
foreach ($source in @($list, $detail, $api)) {
|
|
foreach ($forbidden in @('findNotificationFixture', 'noticeDetail.unread', 'markAsRead', 'targetUrl', 'returnUrl')) {
|
|
if ($source.Contains($forbidden)) { throw "Notification flow retains retired fixture contract: $forbidden" }
|
|
}
|
|
}
|
|
if ($list.Contains('openPage("N02"')) {
|
|
throw 'N01 must not invent a detail link from the generic notification-list response'
|
|
}
|
|
|
|
Write-Output 'N01-N02-MESSAGE-FLOW-CONTRACT PASS'
|