86 lines
4.3 KiB
TypeScript
86 lines
4.3 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import LabRequest from '@/views/inpatientdoctorstation/lab/LabRequest.vue';
|
|
import OutpatientDailySettlement from '@/views/billing/outpatientsettlement/OutpatientDailySettlement.vue';
|
|
import OutpatientChargeReport from '@/views/billing/outpatientcharge/OutpatientChargeReport.vue';
|
|
import PendingMedicalRecord from '@/views/doctorstation/outpatient/PendingMedicalRecord.vue';
|
|
|
|
// @bug466 @regression
|
|
describe('Bug #466: 检验申请单核心质控字段及联动逻辑', () => {
|
|
it('应默认显示申请类型、标本类型、执行时间字段', () => {
|
|
const wrapper = mount(LabRequest, {
|
|
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
|
|
});
|
|
expect(wrapper.find('[data-cy="application-type"]').exists()).toBe(true);
|
|
expect(wrapper.find('[data-cy="specimen-type"]').exists()).toBe(true);
|
|
expect(wrapper.find('[data-cy="execution-time"]').exists()).toBe(true);
|
|
});
|
|
|
|
it('申请类型应默认选中普通,支持切换急诊', () => {
|
|
const wrapper = mount(LabRequest, {
|
|
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
|
|
});
|
|
const radioGroup = wrapper.find('[data-cy="application-type"]');
|
|
expect(radioGroup.vm.modelValue).toBe('1'); // 1: 普通
|
|
radioGroup.vm.$emit('update:modelValue', '2');
|
|
expect(radioGroup.vm.modelValue).toBe('2'); // 2: 急诊
|
|
});
|
|
|
|
it('勾选检验项目后应自动带出标本类型', async () => {
|
|
const wrapper = mount(LabRequest, {
|
|
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
|
|
});
|
|
wrapper.vm.selectedItemIds = [101];
|
|
wrapper.vm.itemList = [{ id: 101, name: '血常规', specimenType: '血液' }];
|
|
await wrapper.vm.$nextTick();
|
|
wrapper.vm.onItemSelectChange([101]);
|
|
await wrapper.vm.$nextTick();
|
|
expect(wrapper.vm.specimenType).toBe('血液');
|
|
});
|
|
|
|
it('执行时间早于当前时间时应拦截并提示', async () => {
|
|
const wrapper = mount(LabRequest, {
|
|
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
|
|
});
|
|
const pastTime = new Date();
|
|
pastTime.setFullYear(pastTime.getFullYear() - 1);
|
|
wrapper.vm.executionTime = pastTime;
|
|
await wrapper.vm.$nextTick();
|
|
|
|
const mockAlert = vi.fn();
|
|
wrapper.vm.$alert = mockAlert;
|
|
wrapper.vm.handleSubmit();
|
|
expect(mockAlert).toHaveBeenCalledWith('执行时间不可早于当前时间', '提示', { type: 'warning' });
|
|
});
|
|
});
|
|
|
|
// @bug568 @regression
|
|
describe('Bug #568: 收费工作站-门诊日结排版修复', () => {
|
|
it('门诊日结页面应包含清晰的布局结构:顶部筛选区、汇总卡片区、明细表格区', () => {
|
|
const wrapper = mount(OutpatientDailySettlement, {
|
|
global: { stubs: ['el-card', 'el-form', 'el-form-item', 'el-date-picker', 'el-select', 'el-option', 'el-button', 'el-row', 'el-col', 'el-table', 'el-table-column'] }
|
|
});
|
|
expect(wrapper.find('.settlement-filter-area').exists()).toBe(true);
|
|
expect(wrapper.find('.settlement-summary-cards').exists()).toBe(true);
|
|
expect(wrapper.find('.settlement-detail-table').exists()).toBe(true);
|
|
});
|
|
});
|
|
|
|
// @bug590 @regression
|
|
describe('Bug #590: 门诊医生工作站-待写病历操作卡片排版修复', () => {
|
|
it('“查看患者”与“写病历”按钮应在同一行排列,且容器使用 flex 布局防止错乱', () => {
|
|
const wrapper = mount(PendingMedicalRecord, {
|
|
global: { stubs: ['el-card', 'el-button', 'el-tag', 'el-empty', 'el-pagination', 'el-form', 'el-form-item', 'el-input'] }
|
|
});
|
|
const actionContainer = wrapper.find('.record-action-bar');
|
|
expect(actionContainer.exists()).toBe(true);
|
|
// 验证 flex 布局确保同行排列,避免换行或错位
|
|
const styleAttr = actionContainer.attributes('style') || '';
|
|
expect(styleAttr).toContain('display: flex');
|
|
expect(styleAttr).toContain('align-items: center');
|
|
// 验证两个操作按钮存在且可交互
|
|
expect(wrapper.find('[data-cy="view-patient"]').exists()).toBe(true);
|
|
expect(wrapper.find('[data-cy="write-record"]').exists()).toBe(true);
|
|
});
|
|
});
|