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')
|
|
|
|
|
})
|
|
|
|
|
|
2026-08-14 14:27:03 +08:00
|
|
|
it('provides scoped upload and deletion without exposing manual file ids', () => {
|
2026-08-11 19:59:15 +08:00
|
|
|
expect(source).not.toContain('referenceTruckAppointmentAttachment')
|
|
|
|
|
expect(source).not.toContain('输入文件服务 ID')
|
2026-08-14 14:27:03 +08:00
|
|
|
expect(source).toContain('uploadTruckAppointmentAttachment')
|
|
|
|
|
expect(source).toContain('上传并关联')
|
2026-08-11 19:59:15 +08:00
|
|
|
expect(source).toContain('deleteTruckAppointmentAttachment')
|
2026-08-14 14:27:03 +08:00
|
|
|
expect(source).toContain("confirmButtonText: '确认', cancelButtonText: '取消'")
|
2026-08-11 19:59:15 +08:00
|
|
|
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
|
|
|
})
|
|
|
|
|
})
|