52 lines
2.4 KiB
TypeScript
52 lines
2.4 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|||
|
|
import { resolve } from 'node:path'
|
||
|
|
import { describe, expect, it } from 'vitest'
|
||
|
|
import { unifiedOrderStatusOptions } from '../api/unifiedOrders'
|
||
|
|
|
||
|
|
const source = readFileSync(resolve(process.cwd(), 'src/modules/unified-orders/pages/UnifiedOrdersView.vue'), 'utf8')
|
||
|
|
|
||
|
|
describe('UnifiedOrdersView contract', () => {
|
||
|
|
it('only exposes the seven product main statuses', () => {
|
||
|
|
expect(unifiedOrderStatusOptions.map((item) => item.label)).toEqual([
|
||
|
|
'待审核', '待测量数据', '已入库', '待分柜', '装柜中', '装柜完成', '派送完成',
|
||
|
|
])
|
||
|
|
for (const legacyLabel of ['待客户确认', '差异处理中', '派送中', '进入分柜']) {
|
||
|
|
expect(source).not.toContain(legacyLabel)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
it('covers real list states and keeps operation column first and left-fixed', () => {
|
||
|
|
expect(source).toContain("{ key: 'actions', label: '操作', width: 180, fixed: 'left'")
|
||
|
|
expect(source).toContain('title="订单列表暂时无法加载"')
|
||
|
|
expect(source).toContain('empty-text="暂无符合条件的订单"')
|
||
|
|
expect(source).toContain(':loading="loading"')
|
||
|
|
expect(source).toContain('v-model:page="page"')
|
||
|
|
expect(source).toContain('v-model:page-size="pageSize"')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('keeps business actions as explicit C01/C03/C04/C06 boundaries', () => {
|
||
|
|
expect(source).toContain('nextActionBoundary')
|
||
|
|
expect(source).toContain('待接入:${label}')
|
||
|
|
expect(source).toContain('CONFIRM_PRELOAD')
|
||
|
|
expect(source).toContain("can('platform:firstleg:inbound:view')")
|
||
|
|
expect(source).toContain('openMeasurement')
|
||
|
|
expect(source).not.toContain('updateMainStatus')
|
||
|
|
expect(source).not.toContain('人工进入分柜')
|
||
|
|
expect(source).not.toContain('performPlatformUnifiedOrderAction')
|
||
|
|
expect(source).not.toContain('/actions/')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('provides unified detail, history and internal note states', () => {
|
||
|
|
expect(source).toContain('getPlatformUnifiedOrder')
|
||
|
|
expect(source).toContain('aria-label="状态历史"')
|
||
|
|
expect(source).toContain('aria-label="内部备注"')
|
||
|
|
expect(source).toContain('订单详情暂时无法加载')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('exposes the C06 workflow entry only for inbound-backed downstream states', () => {
|
||
|
|
expect(source).toContain("name: 'unified-order-workflow'")
|
||
|
|
expect(source).toContain("['WAIT_SPLIT', 'LOADING', 'LOADED'].includes(row.mainStatus)")
|
||
|
|
expect(source).toContain('后半程作业')
|
||
|
|
})
|
||
|
|
})
|