Files
cbb-refresh-verify-795/tests/CBBRefresh.Core.Tests.ps1
T
阿白叔 11a2b2e46e Import CBB refresh verify r4 stability baseline
Preserve tested Verify source, authoritative READY checks, bounded bridge retries, diagnostics and failure-only reporting. Include 336-test suite and packaging assets; exclude live Mentor samples, field logs, backups and distributions.
2026-09-29 15:05:20 +08:00

36 lines
1.7 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$root = Split-Path $PSScriptRoot -Parent
Import-Module (Join-Path $root 'CBBRefresh.Core.psm1') -Force
function Assert-Equal {
param($Expected, $Actual, [string]$Message)
if ($Expected -ne $Actual) { throw "$Message (expected '$Expected', got '$Actual')" }
}
$before = Read-CbbRefreshStatus -Path (Join-Path $root 'examples\library-verify-before.json')
$next = Get-CbbRefreshNextAction -Status $before
Assert-Equal 'verify_result' $next.State 'yellow Verify state is selected first'
Assert-Equal 'run_cbb_verify' $next.Action 'Verify action is mapped'
if (Test-CbbRefreshAllGreen -Status $before) { throw 'before status must not be all green' }
$green = Read-CbbRefreshStatus -Path (Join-Path $root 'examples\library-verify-green.json')
if (-not (Test-CbbRefreshAllGreen -Status $green)) { throw 'green fixture must be all green' }
$verification = New-CbbRefreshVerification -Status $green -Observations @($green.observations)
Assert-Equal 'PASS' $verification.result 'all green status passes'
Assert-Equal $null $verification.nextAction 'all green status has no next action'
$importer = Get-CbbReuseBlockImporterPath -MentorBin $env:SDD_LM_BIN
if ([IO.Path]::GetFileName($importer) -ne 'ReuseBlockImporter.exe') {
throw 'ReuseBlockImporter path did not resolve to the expected executable.'
}
$threw = $false
try {
Invoke-CbbReuseBlockContentCheck -LmcFile (Join-Path $root 'fixtures\cloned-library\mentor_lib.lmc') `
-BlockName '1GPHY_RTL8211F_A' -LibSpec 'EE7.9' -DmsLoginConfig '' -MentorBin $env:SDD_LM_BIN
}
catch { $threw = $true }
if (-not $threw) { throw 'Empty DMS login configuration must be rejected before launching the checker.' }
Write-Output 'CBB refresh core tests passed.'