28 lines
1.0 KiB
PowerShell
28 lines
1.0 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$html = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot '..\index.html')
|
|
|
|
$required = @(
|
|
'totalWeightLb:203.0',
|
|
'totalWeightLb:99.9',
|
|
"totalBoxes:'总箱数'",
|
|
"totalWeight:'总重量'",
|
|
"totalBoxes:'Total cartons'",
|
|
"totalWeight:'Total weight'",
|
|
"totalBoxes:'Total de cajas'",
|
|
"totalWeight:'Peso total'",
|
|
'pickTasks.reduce((sum,task)=>sum+Number(task.palletCount||0),0)',
|
|
'pickTasks.reduce((sum,task)=>sum+Number(task.boxes||0),0)',
|
|
'pickTasks.reduce((sum,task)=>sum+Number(task.totalWeightLb||0),0)',
|
|
'${totalWeight.toFixed(1)} lb'
|
|
)
|
|
|
|
$missing = $required | Where-Object { -not $html.Contains($_) }
|
|
if ($missing) { throw "Missing handover summary contract: $($missing -join ', ')" }
|
|
|
|
$handoverSource = [regex]::Match($html, '(?s)function handoverView\(\).*?(?=function handleHandoverPhoto)').Value
|
|
if ($handoverSource.Contains('<span>${t(''boxes'')}</span>')) {
|
|
throw 'Handover still uses the generic cartons label'
|
|
}
|
|
|
|
Write-Output 'PASS: handover summary source contract'
|