2026-08-11 19:59:15 +08:00
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import { resolve } from 'node:path'
|
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
|
|
|
|
|
const source = readFileSync(resolve(process.cwd(), 'src/modules/trucking/components/TruckAttachmentDialog.vue'), 'utf8')
|
|
|
|
|
|
|
|
|
|
describe('TruckAttachmentDialog interaction governance', () => {
|
|
|
|
|
it('shows existing attachments without exposing file-service internals', () => {
|
|
|
|
|
expect(source).toContain('预约附件')
|
|
|
|
|
expect(source).toContain('attachmentTypeLabel(item.attachmentType)')
|
|
|
|
|
expect(source).not.toContain('文件 ID')
|
|
|
|
|
expect(source).not.toContain('item.objectKey')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('hides the unavailable manual reference flow but keeps deletion', () => {
|
|
|
|
|
expect(source).not.toContain('referenceTruckAppointmentAttachment')
|
|
|
|
|
expect(source).not.toContain('输入文件服务 ID')
|
|
|
|
|
expect(source).toContain('deleteTruckAppointmentAttachment')
|
|
|
|
|
expect(source).toContain('<Trash2 :size="15" />删除')
|
2026-08-12 18:16:44 +08:00
|
|
|
expect(source).toContain('size="small" type="danger" plain')
|
|
|
|
|
expect(source).not.toContain(' text type="danger"')
|
2026-08-11 19:59:15 +08:00
|
|
|
})
|
|
|
|
|
})
|