优化
This commit is contained in:
@@ -7,6 +7,7 @@ const apiSource = readFileSync(new URL('./api/deliveryOrders.ts', import.meta.ur
|
||||
const routesSource = readFileSync(new URL('./routes.ts', import.meta.url), 'utf8')
|
||||
const listSource = readFileSync(new URL('./views/DeliveryOrdersView.vue', import.meta.url), 'utf8')
|
||||
const detailSource = readFileSync(new URL('./views/DeliveryOrderDetailView.vue', import.meta.url), 'utf8')
|
||||
const deliveryStyles = readFileSync(new URL('./views/deliveryOrders.css', import.meta.url), 'utf8')
|
||||
const createSource = readFileSync(new URL('./views/DeliveryOrderCreateView.vue', import.meta.url), 'utf8')
|
||||
const permissionSource = readFileSync(new URL('../tenant-management/contracts.ts', import.meta.url), 'utf8')
|
||||
|
||||
@@ -38,19 +39,18 @@ test('keeps list, read-only detail and create permissions independent in active
|
||||
})
|
||||
|
||||
test('renders the operation column first and covers loading, empty, error and pagination states', () => {
|
||||
const operationIndex = listSource.indexOf('label="操作"')
|
||||
const deliveryNumberIndex = listSource.indexOf('label="派送单号"')
|
||||
const operationIndex = listSource.indexOf("label: '操作'")
|
||||
const deliveryNumberIndex = listSource.indexOf("label: '派送单号'")
|
||||
assert.ok(operationIndex >= 0 && operationIndex < deliveryNumberIndex)
|
||||
assert.match(listSource, /v-loading="loading"/)
|
||||
assert.match(listSource, /:loading="loading"/)
|
||||
assert.match(listSource, /empty-text="暂无派送单"/)
|
||||
assert.match(listSource, /delivery-state--error/)
|
||||
assert.match(listSource, /@click="loadOrders">重试/)
|
||||
assert.match(listSource, /listDeliveryOrders\(buildQuery\(\)\)/)
|
||||
assert.match(listSource, /<el-pagination/)
|
||||
assert.match(listSource, /v-model:current-page="page"/)
|
||||
assert.match(listSource, /<DataTable/)
|
||||
assert.match(listSource, /v-model:page="page"/)
|
||||
assert.match(listSource, /v-model:page-size="pageSize"/)
|
||||
assert.match(listSource, /@current-change="changePage"/)
|
||||
assert.match(listSource, /@size-change="changePageSize"/)
|
||||
assert.match(listSource, /watch\(\[page, pageSize\]/)
|
||||
assert.match(apiSource, /\.then\(normalizeDeliveryPage\)/)
|
||||
assert.match(apiSource, /total: Number\(data\.total\)/)
|
||||
assert.doesNotMatch(listSource, /row\.id[^a-zA-Z]|deliveryNo \|\| row\.id|customerId|tenantId/)
|
||||
@@ -66,10 +66,26 @@ test('loads a typed detail route by delivery number and never exposes an interna
|
||||
assert.match(detailSource, /defineProps<\{ deliveryNo: string \}>/)
|
||||
assert.match(detailSource, /getDeliveryOrder\(props\.deliveryNo\)/)
|
||||
assert.match(detailSource, /派送单详情加载失败/)
|
||||
for (const heading of ['订单信息', '运输与预约', '货物明细', '费用明细']) assert.match(detailSource, new RegExp(heading))
|
||||
for (const heading of ['订单概览', '运输与预约', '货物明细', '费用明细']) assert.match(detailSource, new RegExp(heading))
|
||||
assert.doesNotMatch(detailSource, /detail\?\.id|deliveryNo \|\| detail\?\.id|customerId|tenantId/)
|
||||
})
|
||||
|
||||
test('renders a compact customer-readable delivery detail surface', () => {
|
||||
assert.match(detailSource, /<article class="delivery-detail-surface">/)
|
||||
assert.match(detailSource, /<el-button link type="primary" @click="backToList"><ArrowLeft[^>]*\/>返回列表<\/el-button>/)
|
||||
assert.match(detailSource, /class="client-status" :data-tone="statusTone\(detail\.status\)"/)
|
||||
assert.match(detailSource, /TRUCK_PALLET: '卡派打托'/)
|
||||
assert.match(detailSource, /WAREHOUSE_PICKUP: '仓库自提'/)
|
||||
assert.match(detailSource, /PALLET: '托盘'/)
|
||||
assert.match(detailSource, /TRUCK: '卡车'/)
|
||||
assert.match(detailSource, /SELF: '自有账号'/)
|
||||
assert.match(detailSource, /formatter: tableValueFormatter/)
|
||||
assert.match(detailSource, /<DataTable :data="items" :columns="itemColumns"/)
|
||||
assert.match(detailSource, /<DataTable :data="detail\.fees" :columns="feeColumns"/)
|
||||
assert.doesNotMatch(detailSource, /<h2[^>]*>派送单详情<\/h2>|display\(detail\.status\)/)
|
||||
assert.match(deliveryStyles, /delivery-detail-surface \.delivery-detail-grid div\{display:grid;min-height:42px;/)
|
||||
})
|
||||
|
||||
test('submits the complete create contract with stable retry idempotency and recoverable failures', () => {
|
||||
for (const model of ['dispatchNo', 'plannedDeliveryAt', 'deliveryMethod', 'pickupMethod', 'loadingType', 'waybillNo', 'carrierName', 'vehicleType', 'vehicleSize', 'driverName', 'driverPhone', 'vehiclePlate', 'appointmentAccount', 'sellerName', 'remark']) {
|
||||
assert.match(createSource, new RegExp(`v-model="form\\.${model}"`))
|
||||
|
||||
Reference in New Issue
Block a user