test: distinguish active and void overview photos

This commit is contained in:
2026-08-14 22:43:07 +08:00
parent 011c30cc09
commit 0c845874f4
2 changed files with 5 additions and 1 deletions
@@ -69,7 +69,7 @@ export async function run(context) {
`taskStatus=${overview.pda.taskStatus || 'missing'}, workflowStatus=${overview.pda.workflowStatus || 'missing'}, completed=${overview.pda.completedItemCount ?? 'missing'}/${overview.pda.itemCount ?? 'missing'}`, OPTIONS)
for (const [index, photo] of overview.pda.photos.entries()) {
context.assert(MODULE, `overview PDA 照片摘要 ${index + 1} 字段完整`, overviewResponse,
['evidenceId', 'fileId', 'status', 'downloadPath'].every((field) => photo[field] !== undefined),
['evidenceId', 'fileId', 'status'].every((field) => photo[field] !== undefined),
`fileId=${id(photo.fileId)}`, OPTIONS)
const downloadPath = String(photo.downloadPath || '')
if (photo.status === 'VOID') {
@@ -41,12 +41,16 @@ test('overview regression requires workflowStatus and distinguishes 100 percent
test('active overview photos download through controlled paths while void history has no download entry', () => {
assert.match(overviewOpenApi, /\/api\/platform\/v1\/containers\/\{id\}\/pda\/photos\/\{fileId\}\/download/)
assert.match(overviewAcceptance, /\['evidenceId', 'fileId', 'status'\]\.every/)
assert.doesNotMatch(overviewAcceptance, /\['evidenceId', 'fileId', 'status', 'downloadPath'\]\.every/)
assert.match(overviewAcceptance, /context\.requestBinary\('GET', downloadPath\)/)
assert.match(overviewAcceptance, /photo\.status === 'VOID'/)
assert.match(overviewAcceptance, /overview PDA 作废照片 \$\{index \+ 1\} 无下载入口/)
assert.match(overviewAcceptance, /photo\.status !== 'ACTIVE' \|\| !controlledPath/)
assert.match(overviewOpenApi, /status: \{type: string, enum: \[ACTIVE, VOID\]\}/)
assert.match(overviewOpenApi, /downloadPath: \{type: string, nullable: true, description: '仅 ACTIVE 照片提供鉴权下载路径;VOID 历史照片为空'\}/)
assert.equal(overviewAcceptance.indexOf("if (photo.status === 'VOID')")
< overviewAcceptance.indexOf("context.requestBinary('GET', downloadPath)"), true)
assert.equal(controlledPhotoDownload('/api/platform/v1/containers/7/pda/photos/23/download', {
http: 200, bytes: new Uint8Array([1]), contentType: 'image/png',
}), true)