优化
This commit is contained in:
@@ -8,7 +8,7 @@ test('overseas PDA is an independent Vue 3 app with separate packaging identity'
|
||||
const [manifest, pages, pkg] = await Promise.all([
|
||||
read('../src/manifest.json'), read('../src/pages.json'), read('../package.json')
|
||||
])
|
||||
assert.match(manifest, /"name"\s*:\s*"柏悦物流海外版"/)
|
||||
assert.match(manifest, /"name"\s*:\s*"柏悦物流\s*PDA\s*海外版"/)
|
||||
assert.match(manifest, /"packagename"\s*:\s*"com\.baiyuelogistics\.pda\.overseas"/)
|
||||
assert.match(manifest, /"vueVersion"\s*:\s*"3"/)
|
||||
assert.doesNotMatch(pages, /pages\/picking|pages\/tasks/)
|
||||
@@ -41,3 +41,13 @@ test('login has no committed demo credentials and inbound operation implements t
|
||||
assert.match(overseas, /replaceTokens|refreshOverseasToken/)
|
||||
assert.match(overseas, /requestId/)
|
||||
})
|
||||
|
||||
test('unimplemented warehouse operations cannot submit prototype scans', async () => {
|
||||
const [operation, home, module] = await Promise.all([
|
||||
read('../src/pages/operation/operation.vue'), read('../src/pages/home/home.vue'), read('../src/pages/module/module.vue')
|
||||
])
|
||||
assert.doesNotMatch(operation, /prototypeScan|prototypeInput/)
|
||||
assert.match(operation, /功能暂未开放|扫码不会提交/)
|
||||
assert.match(home, /operation\.badge/)
|
||||
assert.match(module, /专用接口、权限与仓库范围契约完成前保持禁用/)
|
||||
})
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
PDA_AUTHORITY, PDA_ROLE, replaceTokens, restoreSession, session,
|
||||
decodeAccessToken, signInWithTokens, signOut, validatePdaTokenPair
|
||||
} from '../src/stores/session.js'
|
||||
import { receiving } from '../src/stores/receiving.js'
|
||||
|
||||
const future = () => Math.floor(Date.now() / 1000) + 3600
|
||||
const jwt = (claims) => [
|
||||
@@ -114,3 +115,33 @@ test('restore rebuilds identity from claims and removes expired or tampered stor
|
||||
assert.equal(restoreSession(), false)
|
||||
assert.equal(values.has('overseas-pda-auth-session'), false)
|
||||
})
|
||||
|
||||
test('sign out clears tokens, frozen warehouse identity, and every receiving draft', () => {
|
||||
const values = storage(); signOut()
|
||||
signInWithTokens(tokenPair())
|
||||
receiving.candidates = [{ containerNo: 'CONT-1' }]
|
||||
receiving.current = { containerNo: 'CONT-1', status: 'RECEIVING' }
|
||||
receiving.selected = receiving.current
|
||||
receiving.photoSlots = [{ fileId: '1' }, null, null]
|
||||
receiving.selectedInboundCode = 'IN-1'
|
||||
receiving.resolvedCarton = { cartonMark: 'BOX-1' }
|
||||
receiving.resolvedSku = { skuCode: 'SKU-1' }
|
||||
receiving.resolvedPallet = { palletCode: 'PALLET-1' }
|
||||
receiving.lastReceipt = { acceptedPackages: 1 }
|
||||
|
||||
signOut()
|
||||
assert.equal(session.currentUser, null)
|
||||
assert.equal(session.token, '')
|
||||
assert.equal(session.domesticToken, '')
|
||||
assert.equal(session.refreshToken, '')
|
||||
assert.equal(values.has('overseas-pda-auth-session'), false)
|
||||
assert.deepEqual(receiving.candidates, [])
|
||||
assert.equal(receiving.current, null)
|
||||
assert.equal(receiving.selected, null)
|
||||
assert.deepEqual(receiving.photoSlots, [null, null, null])
|
||||
assert.equal(receiving.selectedInboundCode, '')
|
||||
assert.equal(receiving.resolvedCarton, null)
|
||||
assert.equal(receiving.resolvedSku, null)
|
||||
assert.equal(receiving.resolvedPallet, null)
|
||||
assert.equal(receiving.lastReceipt, null)
|
||||
})
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { MODULES } from '../src/data/overseas-workbench.js'
|
||||
|
||||
test('only operations backed by a dedicated overseas PDA contract are enabled', () => {
|
||||
const operations = MODULES.flatMap((module) => module.operations.map((operation) => ({ module: module.key, ...operation })))
|
||||
const enabled = operations.filter((operation) => operation.available)
|
||||
assert.deepEqual(enabled.map(({ module, name }) => ({ module, name })), [{ module: 'inbound', name: '拆柜收货' }])
|
||||
|
||||
const pendingNames = ['库存盘点', '商品移库', '托盘管理', '换标收货', '换标执行', '换标复核', '库存查询', '库位查询', '托盘查询']
|
||||
for (const name of pendingNames) {
|
||||
const operation = operations.find((item) => item.name === name)
|
||||
assert.equal(operation?.available, false, `${name} must fail closed until its PDA API exists`)
|
||||
assert.equal(operation?.badge, '待 PDA 接口')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user