优化
This commit is contained in:
@@ -25,16 +25,19 @@ test('overseas workbench contains only confirmed inbound and in-warehouse domain
|
||||
assert.match(runtime, /VITE_OVERSEAS_API_BASE_URL/)
|
||||
})
|
||||
|
||||
test('login has no committed demo credentials and inbound operation consumes real overseas APIs', async () => {
|
||||
const [login, operation, inbound, overseas] = await Promise.all([
|
||||
test('login has no committed demo credentials and inbound operation implements the locked container flow', async () => {
|
||||
const [login, operation, inbound, adapter, overseas] = await Promise.all([
|
||||
read('../src/pages/login/login.vue'), read('../src/pages/operation/operation.vue'),
|
||||
read('../src/api/inbound.js'), read('../src/api/overseas.js')
|
||||
read('../src/api/inbound.js'), read('../src/api/receiving-adapter.js'), read('../src/api/overseas.js')
|
||||
])
|
||||
assert.match(login, /柏悦物流海外版/)
|
||||
assert.doesNotMatch(login, /ChangeMe|platform_admin/)
|
||||
assert.match(operation, /startScanBroadcast/)
|
||||
for (const action of ['pushInboundTask', 'assignInboundPallet', 'countInboundPackages', 'pickInboundPackages', 'scanInboundCarton', 'uploadUnloadPhotoFile', 'bindUnloadPhotos', 'completeInboundTask']) assert.match(operation, new RegExp(action))
|
||||
for (const path of ['/push', '/allocations/', '/cartons/scan', '/unload-photos', '/complete']) assert.match(inbound, new RegExp(path.replace('/', '\\/')))
|
||||
for (const action of ['prepareReceivingContainer', 'getCurrentReceiving', 'resolveCurrentSku', 'resolveCurrentCarton', 'resolveCurrentPallet', 'receiveCurrentBulk', 'receiveCurrentCarton', 'completeCurrentReceiving']) assert.match(operation, new RegExp(action))
|
||||
for (const path of ['/candidates', '/prepare', '/unload-photos/files', '/sign', '/skus/resolve', '/cartons/resolve', '/pallets/resolve', '/receipts/bulk', '/receipts/carton', '/complete']) assert.match(inbound, new RegExp(path.replaceAll('/', '\\/')))
|
||||
for (const role of ['LICENSE_PLATE', 'CONTAINER_SEAL', 'DOOR_OPEN']) assert.match(adapter, new RegExp(role))
|
||||
for (const forbidden of ['customerId', 'planNo', 'allocationId', 'warehouseId', 'locationId']) assert.doesNotMatch(inbound, new RegExp(forbidden))
|
||||
assert.match(operation, /isReceivingConflict|recoverCurrentAfterConflict/)
|
||||
assert.match(overseas, /replaceTokens|refreshOverseasToken/)
|
||||
assert.match(overseas, /requestId/)
|
||||
})
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { isNoCurrentReceiving, isReceivingConflict, normalizeReceivingCandidate, normalizeReceivingSession, RECEIVING_PHOTO_ROLES } from '../src/api/receiving-adapter.js'
|
||||
|
||||
test('receiving adapter preserves the three signed photo roles in workflow order', () => {
|
||||
const session = normalizeReceivingSession({
|
||||
status: 'WAIT_SIGN', totalPackages: 8, receivedPackages: 2, pendingPackages: 6,
|
||||
photos: [{ role: 'DOOR_OPEN', fileId: 3 }, { role: 'LICENSE_PLATE', fileId: 1 }, { role: 'CONTAINER_SEAL', fileId: 2 }],
|
||||
inbounds: [{ inboundCode: 'IN-1', plannedPalletCount: 2, totalPackages: 8, receivedPackages: 2, pendingPackages: 6 }]
|
||||
})
|
||||
assert.deepEqual(session.photos.map(({ role }) => role), RECEIVING_PHOTO_ROLES)
|
||||
assert.equal(session.inbounds[0].plannedPalletCount, 2)
|
||||
})
|
||||
|
||||
test('receiving adapter exposes calculable candidate facts and workflow errors', () => {
|
||||
const candidate = normalizeReceivingCandidate({ destinationCodes: ['ONT8', 'LAX'], plannedPalletCount: 4, currentAccount: true })
|
||||
assert.deepEqual(candidate.destinationCodes, ['ONT8', 'LAX'])
|
||||
assert.equal(candidate.plannedPalletCount, 4)
|
||||
assert.equal(candidate.currentAccount, true)
|
||||
assert.equal(isNoCurrentReceiving({ code: 404 }), true)
|
||||
assert.equal(isReceivingConflict({ code: 'B0409' }), true)
|
||||
})
|
||||
Reference in New Issue
Block a user