87 lines
4.1 KiB
TypeScript
87 lines
4.1 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';
|
|
|
|
// @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);
|
|
});
|
|
});
|
|
|
|
// @bug579 @regression
|
|
describe('Bug #579: 门诊收费报表列表格式修复', () => {
|
|
it('门诊收费报表表格列应正确对齐且字段一一对应,防止排版错乱', () => {
|
|
const wrapper = mount(OutpatientChargeReport, {
|
|
global: { stubs: ['el-card', 'el-form', 'el-form-item', 'el-date-picker', 'el-select', 'el-option', 'el-button', 'el-table', 'el-table-column', 'el-pagination', 'el-tag'] }
|
|
});
|
|
const table = wrapper.find('el-table-stub');
|
|
expect(table.exists()).toBe(true);
|
|
|
|
const columns = wrapper.findAll('el-table-column-stub');
|
|
expect(columns.length).toBeGreaterThan(0);
|
|
|
|
// 验证所有列均配置了对齐属性,避免默认左对齐导致的数字/状态列错位
|
|
columns.forEach(col => {
|
|
expect(col.attributes('align')).toBeDefined();
|
|
expect(col.attributes('prop')).toBeDefined();
|
|
});
|
|
});
|
|
});
|