This commit is contained in:
2026-08-25 20:50:01 +08:00
parent f6d4ed6c3c
commit 6572771227
12 changed files with 341 additions and 86 deletions
+8 -5
View File
@@ -3,6 +3,7 @@ import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
const source = await readFile(new URL('../api/pda-loading.js', import.meta.url), 'utf8')
const http = await readFile(new URL('../api/http.js', import.meta.url), 'utf8')
const page = await readFile(new URL('../pages/picking/picking.vue', import.meta.url), 'utf8')
test('PDA loading adapter keeps C04 read and write paths', () => {
@@ -17,7 +18,8 @@ test('PDA loading adapter keeps C04 read and write paths', () => {
assert.match(source, /'Idempotency-Key'/)
assert.match(source, /PHOTO_STEP_1[\s\S]*PHOTO_STEP_4[\s\S]*SEAL/)
for (const label of ['空仓照片', '半仓照片', '满仓照片', '锁仓照片', '带锁码照']) assert.match(source, new RegExp(label))
assert.match(source, /uni\.uploadFile/)
assert.match(source, /apiUpload\(/)
assert.match(http, /uni\.uploadFile/)
assert.match(source, /\/files\/loading-evidence\//)
assert.match(source, /loading\/evidence\/pda\?tenantId=/)
assert.match(source, /loading\/evidence\/\$\{encodeURIComponent\(evidenceId\)\}\/void\/pda\?tenantId=/)
@@ -27,8 +29,8 @@ test('PDA loading adapter keeps C04 read and write paths', () => {
})
test('PDA adapter does not treat non-200 response bodies or network failures as success', () => {
assert.match(source, /if \(code !== '200'\)/)
assert.match(source, /next\.network = true/)
assert.match(http, /if \(code !== '200'\)/)
assert.match(http, /next\.network = true/)
assert.match(source, /throw new Error\('缺少客户隔离标识 tenantId/)
})
@@ -81,8 +83,9 @@ test('PDA downloads authenticated evidence previews returned by the backend', ()
assert.match(source, /export function getEvidencePreviewUrl\(inboundId, evidenceId, tenantId\)/)
assert.match(source, /loading\/evidence\/\$\{encodeURIComponent\(evidenceId\)\}\/content\/pda\?tenantId=/)
assert.match(source, /export function downloadEvidencePreview\(previewUrl\)/)
assert.match(source, /uni\.downloadFile\(/)
assert.match(source, /headers\.Authorization = `Bearer \$\{session\.token\}`/)
assert.match(source, /apiDownload\(\{ url \}\)/)
assert.match(http, /uni\.downloadFile\(/)
assert.match(http, /headers\.Authorization = `Bearer \$\{accessToken\}`/)
assert.match(source, /response\.tempFilePath/)
assert.match(source, /evidence\.preview\.response/)
assert.match(source, /\^image\\\//)