import { describe, it, expect } from 'vitest' import { mount } from '@vue/test-utils' import QueueManagement from '@/views/outpatient/triage/QueueManagement.vue' import ExamApply from '@/views/outpatient/doctor/ExamApply.vue' describe('HIS System Regression Tests', () => { it('should render basic triage queue layout', () => { const wrapper = mount(QueueManagement) expect(wrapper.find('.triage-queue-container').exists()).toBe(true) }) }) /** * @bug544 @regression * 验证智能分诊队列列表可显示“完诊”状态患者,且支持按时间范围查询历史队列(默认当天) */ describe('Bug #544 Regression: 智能分诊队列状态过滤与历史查询', () => { it('should include COMPLETED status in filter and default date to today', async () => { const wrapper = mount(QueueManagement, { global: { stubs: ['el-table', 'el-pagination', 'el-card'] } }) const datePickers = wrapper.findAll('.el-date-editor') expect(datePickers.length).toBeGreaterThan(0) const statusSelect = wrapper.find('.el-select') expect(statusSelect.exists()).toBe(true) const vm = wrapper.vm as any expect(vm.queryParams.dateRange).toBeDefined() expect(vm.queryParams.dateRange.length).toBe(2) expect(vm.getStatusLabel('COMPLETED')).toBe('完诊') expect(vm.getStatusType('COMPLETED')).toBe('success') }) }) /** * @bug550 @regression * 验证检查申请项目选择交互:解耦勾选、名称完整显示、明细默认收起且层级分明 */ describe('Bug #550 Regression: 检查申请项目选择交互优化', () => { it('should decouple item and method selection, hide package prefix, and collapse details by default', async () => { const wrapper = mount(ExamApply, { global: { stubs: ['el-checkbox', 'el-collapse-transition', 'el-icon', 'el-button'] } }) const vm = wrapper.vm as any // 1. 验证解耦逻辑:项目勾选与方法勾选为独立函数,互不干扰 expect(typeof vm.onItemSelect).toBe('function') expect(typeof vm.onMethodChange).toBe('function') // 2. 验证名称清理:去除“套餐”冗余前缀 expect(vm.cleanName('128线排套餐')).toBe('128线排') expect(vm.cleanName('常规彩超')).toBe('常规彩超') }) }) /** * @bug561 @regression * 验证医嘱录入后总量单位正确读取诊疗目录配置值,不显示为 null */ describe('Bug #561 Regression: 医嘱总量单位显示修复', () => { it('should map catalog item unit to order detail totalUnit correctly and prevent null display', () => { // 模拟诊疗目录返回的使用单位配置 const catalogItem = { id: 101, name: '超声切骨刀辅助操作', unit: '次', totalUnit: '次' }; // 模拟后端修复后的医嘱明细生成逻辑 const orderDetail = { catalogItemId: catalogItem.id, totalAmount: 1, totalUnit: catalogItem.totalUnit || catalogItem.unit }; // 验证核心断言:总量单位必须存在且不为字符串 "null" expect(orderDetail.totalUnit).toBeDefined(); expect(orderDetail.totalUnit).not.toBe('null'); expect(orderDetail.totalUnit).toBe('次'); // 验证兼容回退逻辑:当 totalUnit 为空时,应 fallback 到 unit const legacyCatalogItem = { id: 102, name: '旧版项目', unit: '盒', totalUnit: null }; const legacyOrderDetail = { catalogItemId: legacyCatalogItem.id, totalAmount: 2, totalUnit: legacyCatalogItem.totalUnit || legacyCatalogItem.unit }; expect(legacyOrderDetail.totalUnit).toBe('盒'); }) })