import { describe, it, expect } from 'vitest'; import { DisabilityType, DisabilityTypeLabels, DISABILITY_TYPES, DisabilityLevel, DisabilityLevelLabels, DISABILITY_LEVELS, OrderStatus, OrderStatusLabels, OrderStatusDescriptions, ORDER_STATUSES, WorkStatus, WorkStatusLabels, WorkStatusDescriptions, WORK_STATUSES } from '../../src/index.js'; describe('Allin系统枚举常量', () => { describe('残疾类型枚举 (DisabilityType)', () => { it('应该包含7个有效的残疾类型值', () => { expect(DISABILITY_TYPES).toHaveLength(7); expect(DISABILITY_TYPES).toEqual([ DisabilityType.VISION, DisabilityType.HEARING, DisabilityType.SPEECH, DisabilityType.PHYSICAL, DisabilityType.INTELLECTUAL, DisabilityType.MENTAL, DisabilityType.MULTIPLE ]); }); it('应该与数据库原始值一致(小写字符串)', () => { expect(DisabilityType.VISION).toBe('vision'); expect(DisabilityType.HEARING).toBe('hearing'); expect(DisabilityType.SPEECH).toBe('speech'); expect(DisabilityType.PHYSICAL).toBe('physical'); expect(DisabilityType.INTELLECTUAL).toBe('intellectual'); expect(DisabilityType.MENTAL).toBe('mental'); expect(DisabilityType.MULTIPLE).toBe('multiple'); }); it('应该有正确的中文标签映射', () => { expect(DisabilityTypeLabels[DisabilityType.VISION]).toBe('视力残疾'); expect(DisabilityTypeLabels[DisabilityType.HEARING]).toBe('听力残疾'); expect(DisabilityTypeLabels[DisabilityType.SPEECH]).toBe('言语残疾'); expect(DisabilityTypeLabels[DisabilityType.PHYSICAL]).toBe('肢体残疾'); expect(DisabilityTypeLabels[DisabilityType.INTELLECTUAL]).toBe('智力残疾'); expect(DisabilityTypeLabels[DisabilityType.MENTAL]).toBe('精神残疾'); expect(DisabilityTypeLabels[DisabilityType.MULTIPLE]).toBe('多重残疾'); }); }); describe('残疾等级枚举 (DisabilityLevel)', () => { it('应该包含4个有效的残疾等级值', () => { expect(DISABILITY_LEVELS).toHaveLength(4); expect(DISABILITY_LEVELS).toEqual([ DisabilityLevel.ONE, DisabilityLevel.TWO, DisabilityLevel.THREE, DisabilityLevel.FOUR ]); }); it('应该与数据库原始值一致(数字1-4)', () => { expect(DisabilityLevel.ONE).toBe(1); expect(DisabilityLevel.TWO).toBe(2); expect(DisabilityLevel.THREE).toBe(3); expect(DisabilityLevel.FOUR).toBe(4); }); it('应该有正确的中文标签映射', () => { expect(DisabilityLevelLabels[DisabilityLevel.ONE]).toBe('一级'); expect(DisabilityLevelLabels[DisabilityLevel.TWO]).toBe('二级'); expect(DisabilityLevelLabels[DisabilityLevel.THREE]).toBe('三级'); expect(DisabilityLevelLabels[DisabilityLevel.FOUR]).toBe('四级'); }); }); describe('订单状态枚举 (OrderStatus)', () => { it('应该包含5个有效的订单状态值', () => { expect(ORDER_STATUSES).toHaveLength(5); expect(ORDER_STATUSES).toEqual([ OrderStatus.DRAFT, OrderStatus.CONFIRMED, OrderStatus.IN_PROGRESS, OrderStatus.COMPLETED, OrderStatus.CANCELLED ]); }); it('应该与数据库原始值一致(小写字符串,下划线分隔)', () => { expect(OrderStatus.DRAFT).toBe('draft'); expect(OrderStatus.CONFIRMED).toBe('confirmed'); expect(OrderStatus.IN_PROGRESS).toBe('in_progress'); expect(OrderStatus.COMPLETED).toBe('completed'); expect(OrderStatus.CANCELLED).toBe('cancelled'); }); it('应该有正确的中文标签映射', () => { expect(OrderStatusLabels[OrderStatus.DRAFT]).toBe('草稿'); expect(OrderStatusLabels[OrderStatus.CONFIRMED]).toBe('已确认'); expect(OrderStatusLabels[OrderStatus.IN_PROGRESS]).toBe('进行中'); expect(OrderStatusLabels[OrderStatus.COMPLETED]).toBe('已完成'); expect(OrderStatusLabels[OrderStatus.CANCELLED]).toBe('已取消'); }); it('应该有正确的业务含义描述', () => { expect(OrderStatusDescriptions[OrderStatus.DRAFT]).toBe('订单已创建但未提交,可继续编辑'); expect(OrderStatusDescriptions[OrderStatus.CONFIRMED]).toBe('订单已提交并确认,等待执行'); expect(OrderStatusDescriptions[OrderStatus.IN_PROGRESS]).toBe('订单正在执行中,相关人员正在处理'); expect(OrderStatusDescriptions[OrderStatus.COMPLETED]).toBe('订单已成功完成,所有工作已结束'); expect(OrderStatusDescriptions[OrderStatus.CANCELLED]).toBe('订单已被取消,不再执行'); }); }); describe('工作状态枚举 (WorkStatus)', () => { it('应该包含4个有效的工作状态值', () => { expect(WORK_STATUSES).toHaveLength(4); expect(WORK_STATUSES).toEqual([ WorkStatus.NOT_WORKING, WorkStatus.PRE_WORKING, WorkStatus.WORKING, WorkStatus.RESIGNED ]); }); it('应该与数据库原始值一致(小写字符串,下划线分隔)', () => { expect(WorkStatus.NOT_WORKING).toBe('not_working'); expect(WorkStatus.PRE_WORKING).toBe('pre_working'); expect(WorkStatus.WORKING).toBe('working'); expect(WorkStatus.RESIGNED).toBe('resigned'); }); it('应该有正确的中文标签映射', () => { expect(WorkStatusLabels[WorkStatus.NOT_WORKING]).toBe('未就业'); expect(WorkStatusLabels[WorkStatus.PRE_WORKING]).toBe('待就业'); expect(WorkStatusLabels[WorkStatus.WORKING]).toBe('已就业'); expect(WorkStatusLabels[WorkStatus.RESIGNED]).toBe('已离职'); }); it('应该有正确的业务含义描述', () => { expect(WorkStatusDescriptions[WorkStatus.NOT_WORKING]).toBe('尚未开始工作,正在寻找就业机会'); expect(WorkStatusDescriptions[WorkStatus.PRE_WORKING]).toBe('已安排工作但尚未入职,等待入职手续'); expect(WorkStatusDescriptions[WorkStatus.WORKING]).toBe('正在工作中,处于在职状态'); expect(WorkStatusDescriptions[WorkStatus.RESIGNED]).toBe('工作已结束,已离职'); }); }); });