test(admin): harden booking document workflows

This commit is contained in:
2026-08-31 21:05:03 +08:00
parent 623dfce255
commit 49babd731a
5 changed files with 79 additions and 28 deletions
@@ -66,4 +66,30 @@ describe('OceanBookingDocumentsPanel contract', () => {
expect(source).toContain('订舱资料上传失败,请稍后重试')
expect(source).toContain('订舱资料下载失败,请稍后重试')
})
it('suppresses duplicate file mutations and protects list-only access', () => {
expect(source).toContain('if (busyDocumentId.value || busyType.value) return')
expect(source).toContain('if (busyDocumentId.value || busyType.value || !editable.value) return')
expect(source).toContain('!file || !editable.value || busyType.value || busyDocumentId.value')
expect(source).toContain(':disabled="Boolean(busyType || busyDocumentId)"')
})
it('keeps long Unicode active and invalidated file names readable', () => {
const fileName = '客户资料-中文-🚢-é-'.repeat(16) + '.数据包'
const document = {
id: 'doc-1', oceanBookingId: '123', fileId: 'file-1', documentType: 'BILL_OF_LADING' as const,
fileName, fileHash: null, sizeBytes: 12, contentType: null, valid: true,
uploadedBy: '7', uploadedByName: '操作员', uploadedAt: '2026-08-31',
invalidatedBy: null, invalidatedByName: null, invalidatedAt: null,
}
const wrapper = mount(OceanBookingDocumentsPanel, {
props: { bookingId: '123', bookingVersion: 2, bookingStatus: 'DRAFT', documents: [document], canManage: false, manageReason: '暂无订舱资料维护权限' },
global: { plugins: [ElementPlus] },
})
expect(wrapper.get('.booking-document-list strong').attributes('title')).toBe(fileName)
expect(wrapper.find('input[type="file"]').exists()).toBe(false)
expect(wrapper.text()).not.toContain('作废')
expect(source).toContain('.booking-document-history li span{min-width:0;overflow-wrap:anywhere}')
wrapper.unmount()
})
})