优化
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const read = (path: string) => readFileSync(resolve(process.cwd(), path), 'utf8')
|
||||
|
||||
describe('LineClampText domestic list consumers', () => {
|
||||
it.each([
|
||||
['统一订单', 'src/modules/unified-orders/pages/UnifiedOrdersView.vue'],
|
||||
['入库任务', 'src/modules/inbounds/components/InboundTaskList.vue'],
|
||||
['入库单', 'src/modules/inbounds/pages/InboundOrdersView.vue'],
|
||||
['装柜清单', 'src/modules/loading-lists/components/LoadingListsView.vue'],
|
||||
['柜次智能装柜', 'src/modules/container-loading/pages/SmartLoadingWorkbenchView.vue'],
|
||||
['全局智能装柜', 'src/modules/container-loading/pages/GlobalSmartLoadingView.vue'],
|
||||
])('%s列表复用共享的行数省略组件', (_name, path) => {
|
||||
expect(read(path)).toContain("LineClampText from '@/shared/components/LineClampText.vue'")
|
||||
})
|
||||
|
||||
it('统一订单客户与渠道都使用一行省略,并保留渠道变更标记', () => {
|
||||
const source = read('src/modules/unified-orders/pages/UnifiedOrdersView.vue')
|
||||
expect(source).toContain("column.property === 'customerName'")
|
||||
expect(source).toContain('<LineClampText :content="(row as UnifiedOrderResource).channelName" />')
|
||||
expect(source).toContain('曾变更渠道')
|
||||
})
|
||||
|
||||
it.each([
|
||||
['src/modules/inbounds/components/InboundTaskList.vue', '#customerName', '#channelName'],
|
||||
['src/modules/inbounds/pages/InboundOrdersView.vue', '#customerName', '#channelName'],
|
||||
])('入库列表客户与渠道均使用共享组件:%s', (path, customerSlot, channelSlot) => {
|
||||
const source = read(path)
|
||||
expect(source).toContain(`<template ${customerSlot}`)
|
||||
expect(source).toContain(`<template ${channelSlot}`)
|
||||
expect(source.match(/<LineClampText/g)?.length).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
|
||||
it('装柜清单将多客户汇总限制为一行', () => {
|
||||
const source = read('src/modules/loading-lists/components/LoadingListsView.vue')
|
||||
expect(source).toContain('<template #customers="{ row }"><LineClampText')
|
||||
})
|
||||
|
||||
it.each([
|
||||
'src/modules/container-loading/pages/SmartLoadingWorkbenchView.vue',
|
||||
'src/modules/container-loading/pages/GlobalSmartLoadingView.vue',
|
||||
])('智能装柜候选与已装载客户列使用相同的一行省略:%s', (path) => {
|
||||
const source = read(path)
|
||||
expect(source.match(/slotName: 'customerName'/g)).toHaveLength(2)
|
||||
expect(source.match(/<template #customerName/g)).toHaveLength(2)
|
||||
expect(source.match(/<LineClampText :content=/g)?.length).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user