2026-08-13 17:14:51 +08:00
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import { resolve } from 'node:path'
|
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
|
|
|
|
|
describe('InboundTaskList measurement scope', () => {
|
|
|
|
|
it('uses the inbound tenant isolation key for measurement and review requests', () => {
|
|
|
|
|
const source = readFileSync(resolve('src/modules/inbounds/components/InboundTaskList.vue'), 'utf8')
|
|
|
|
|
|
|
|
|
|
expect(source.match(/:tenant-id="selectedInbound\.tenantId"/g)).toHaveLength(2)
|
|
|
|
|
expect(source).not.toContain('selectedInbound.customerId || selectedInbound.tenantId')
|
|
|
|
|
})
|
2026-08-13 19:00:37 +08:00
|
|
|
|
|
|
|
|
it('opens the shared unified order detail from the view action', () => {
|
|
|
|
|
const source = readFileSync(resolve('src/modules/inbounds/components/InboundTaskList.vue'), 'utf8')
|
|
|
|
|
|
|
|
|
|
expect(source).toContain("name: 'unified-order-detail', params: { orderId: row.orderId }, query: { tenantId: row.tenantId }")
|
|
|
|
|
expect(source).toContain("access.can('platform:firstleg:inbound:view') && (row as InboundOrderSummary).orderId")
|
|
|
|
|
expect(source).not.toContain("name: 'inbound-order-detail', params: { inboundId: row.id }")
|
|
|
|
|
})
|
2026-08-13 19:38:20 +08:00
|
|
|
|
|
|
|
|
it('refreshes cached task lists when users return from measurement work', () => {
|
|
|
|
|
const source = readFileSync(resolve('src/modules/inbounds/components/InboundTaskList.vue'), 'utf8')
|
|
|
|
|
|
|
|
|
|
expect(source).toContain('onActivated(() => {')
|
|
|
|
|
expect(source).toContain('if (!activatedOnce)')
|
|
|
|
|
expect(source).toContain('activatedOnce = true')
|
|
|
|
|
expect(source).toContain('void loadTasks()')
|
|
|
|
|
expect(source).toContain('onMounted(() => { void loadOptions(); void loadTasks() })')
|
|
|
|
|
})
|
2026-08-13 17:14:51 +08:00
|
|
|
})
|