优化
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
import { parseArguments, validateExecutionOptions } from '../admin-test-env-acceptance.mjs'
|
||||
|
||||
const entry = readFileSync(new URL('../admin-test-env-acceptance.mjs', import.meta.url), 'utf8')
|
||||
const fixture = readFileSync(new URL('./manual-pda-batch-fixture.mjs', import.meta.url), 'utf8')
|
||||
const verify = readFileSync(new URL('./manual-pda-batch-verify.mjs', import.meta.url), 'utf8')
|
||||
|
||||
test('manual PDA batch modules are optional and require a source report', () => {
|
||||
assert.match(entry, /OPTIONAL_MODULES\s*=\s*\[[^\]]*'manual-pda-batch-fixture'[^\]]*'manual-pda-batch-verify'/s)
|
||||
const defaults = parseArguments([]).modules
|
||||
assert.equal(defaults.includes('manual-pda-batch-fixture'), false)
|
||||
assert.equal(defaults.includes('manual-pda-batch-verify'), false)
|
||||
for (const module of ['manual-pda-batch-fixture', 'manual-pda-batch-verify']) {
|
||||
const options = parseArguments(['--gateway', 'http://127.0.0.1:9000', '--username', 'admin',
|
||||
'--password', 'password-value', '--modules', module, '--manual-pda-batch-source-report', 'source.json'])
|
||||
assert.deepEqual(options.modules, [module])
|
||||
assert.equal(validateExecutionOptions(options), options)
|
||||
assert.throws(() => validateExecutionOptions({ ...options, manualPdaBatchSourceReport: '' }),
|
||||
/manual-pda-batch-source-report/)
|
||||
}
|
||||
})
|
||||
|
||||
test('PDA batch preparation is read only and preserves stable carton scan instructions', () => {
|
||||
assert.match(fixture, /manualPdaReadyVerification/)
|
||||
assert.match(fixture, /boxCodes\.length >= item\.plannedPackageCount/)
|
||||
assert.match(fixture, /scanBoxCodes: rows\(item\.boxCodes\)/)
|
||||
assert.match(fixture, /inventory-snapshot/)
|
||||
assert.match(fixture, /不存在 CLAIM、BATCH、REVIEW 或 COMPLETE_LOADING/)
|
||||
assert.match(fixture, /逐次扫码动作需保留真机人工证据/)
|
||||
assert.doesNotMatch(fixture, /context\.request\(['"](?:POST|PATCH|PUT|DELETE)/)
|
||||
})
|
||||
|
||||
test('post-batch verifier proves one claim, one batch and AWAITING_REVIEW without writes', () => {
|
||||
assert.match(verify, /workflowStatus === 'AWAITING_REVIEW'/)
|
||||
assert.match(verify, /itemStatus === 'PICKED'/)
|
||||
assert.match(verify, /claimOperations\.length === 1 && batchOperations\.length === 1/)
|
||||
assert.match(verify, /pendingItemCount\) === 0/)
|
||||
assert.match(verify, /expectedCount\) === Number\(projection\?\.pickedCount\)/)
|
||||
assert.match(verify, /HTTP 不记录逐次扫码轨迹/)
|
||||
assert.doesNotMatch(verify, /context\.request\(['"](?:POST|PATCH|PUT|DELETE)/)
|
||||
})
|
||||
Reference in New Issue
Block a user