Merge branch 'release/test' of http://8.163.30.128:10082/html/client-web into release/test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
import ts from 'typescript'
|
||||
|
||||
const routes = readFileSync(new URL('./routes.ts', import.meta.url), 'utf8')
|
||||
const services = readFileSync(new URL('./views/WarehouseServiceView.vue', import.meta.url), 'utf8')
|
||||
@@ -41,13 +42,31 @@ test('opens warehouse service and return receipt details as dedicated protected
|
||||
})
|
||||
|
||||
test('returns to the labeling list after a labeling application is submitted', () => {
|
||||
assert.match(services, /ElMessage\.success\(`\$\{config\.value\.title\}提交成功`\)[\s\S]*?router\.push\(\{ name: serviceListRouteName\(props\.service\) \}\)/)
|
||||
assert.match(services, /ElMessage\.success\(`\$\{config\.value\.title\}提交成功`\)[\s\S]*?await goToServiceList\(\)/)
|
||||
// Return-carton sources use the unified relabel application and its file endpoint.
|
||||
assert.match(services, /returnCartonId: item\.returnCartonId/)
|
||||
assert.match(services, /uploadRelabelFile\(created\.application\.relabelNo,[\s\S]*?router\.push\(\{ name: serviceListRouteName\(props\.service\) \}\)/)
|
||||
assert.match(services, /uploadRelabelFile\(created\.application\.relabelNo,[\s\S]*?await goToServiceList\(\)/)
|
||||
assert.match(services, /申请已创建,附件待补传/)
|
||||
})
|
||||
|
||||
test('service list return navigates standalone pages and refreshes embedded lists', async () => {
|
||||
const source = services.slice(services.indexOf('function serviceListRouteName('), services.indexOf('async function openEdit('))
|
||||
const javascript = ts.transpileModule(source, { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText
|
||||
for (const props of [
|
||||
{ service: 'labeling', createPage: true, detailPage: false },
|
||||
{ service: 'labeling', createPage: false, detailPage: true },
|
||||
{ service: 'labeling', createPage: false, detailPage: false },
|
||||
]) {
|
||||
const calls = [], mode = { value: 'create' }
|
||||
const goToServiceList = new Function('props', 'router', 'mode', 'loadPage', `${javascript}; return goToServiceList`)(
|
||||
props, { push: async route => calls.push(route) }, mode, async () => calls.push('refresh'),
|
||||
)
|
||||
await goToServiceList()
|
||||
assert.deepEqual(calls, props.createPage || props.detailPage ? [{ name: 'overseas-labeling' }] : ['refresh'])
|
||||
if (!props.createPage && !props.detailPage) assert.equal(mode.value, 'list')
|
||||
}
|
||||
})
|
||||
|
||||
test('keeps overseas warehouse writes behind operation-specific button permissions', () => {
|
||||
for (const permission of [
|
||||
'merchant:overseas-warehouse:relabel:create',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
import ts from 'typescript'
|
||||
|
||||
const view = readFileSync(new URL('./ReturnOrdersView.vue', import.meta.url), 'utf8')
|
||||
const api = readFileSync(new URL('../api/returnOrders.ts', import.meta.url), 'utf8')
|
||||
@@ -254,7 +255,25 @@ test('待审核退货可编辑,完成入库后从独立新增页发起贴标',
|
||||
assert.match(view, /name: 'overseas-labeling-create'/)
|
||||
assert.match(view, /query: \{ returnNo: order\.returnNo, warehouseId: String\(order\.overseasWarehouseId\)/)
|
||||
assert.match(view, /cartonMark \? \{ cartonMark \}/)
|
||||
assert.match(view, /openRelabel\(selected\.order, current\.carton\.cartonMark\)/)
|
||||
assert.match(view, /v-if="canCreateRelabel && canApplyRelabel\(selected\.order\)"[^>]*@click="openRelabel\(selected\.order\)">贴标申请/)
|
||||
assert.match(view, /v-for="application in row\.relabelApplications \|\| \[\]"/)
|
||||
assert.match(view, /relabelStatusLabel\(application\.status\)/)
|
||||
})
|
||||
|
||||
test('贴标入口保留完成入库门禁与退货来源,箱号只作为目标页库存筛选', () => {
|
||||
const source = view.slice(view.indexOf('function canApplyRelabel('), view.indexOf('async function submit()'))
|
||||
const javascript = ts.transpileModule(source, { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText
|
||||
const routes = []
|
||||
const { canApplyRelabel, openRelabel } = new Function('router', `${javascript}; return { canApplyRelabel, openRelabel }`)({ push: route => routes.push(route) })
|
||||
const order = { returnNo: 'RT-TEST', overseasWarehouseId: 'WH-TEST', status: 'COMPLETED', needRelabel: true }
|
||||
assert.equal(canApplyRelabel(order), true)
|
||||
assert.equal(canApplyRelabel({ ...order, status: 'PENDING_RECEIPT' }), false)
|
||||
assert.equal(canApplyRelabel({ ...order, needRelabel: false }), false)
|
||||
assert.equal(canApplyRelabel({ ...order, relabelNo: 'RL-EXISTS' }), false)
|
||||
openRelabel(order)
|
||||
openRelabel(order, 'RC-TEST')
|
||||
assert.deepEqual(routes, [
|
||||
{ name: 'overseas-labeling-create', query: { returnNo: 'RT-TEST', warehouseId: 'WH-TEST' } },
|
||||
{ name: 'overseas-labeling-create', query: { returnNo: 'RT-TEST', warehouseId: 'WH-TEST', cartonMark: 'RC-TEST' } },
|
||||
])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user