/** 纪要领域:只增不改 + 决议登记不重复 —— domain 测试零 mock(OS 2.1 / 3.1) */ import { describe, expect, it } from 'vitest'; import { addResolution, markRegistered, newMinute, registeredWorkflowOf } from '../internal/domain/minute.ts'; const base = newMinute({ id: 'm1', title: '7 月报价例会', body: '讨论 Q3 报价口径', authorId: 's-pm', participants: ['s-pm', 's-bd'], occurredOn: '2026-07-27', resolutions: [{ id: 'r1', text: '统一 TYPE-B 的寻源时限为 3 天', ownerId: 's-prm' }], at: '2026-07-27T02:00:00.000Z', }); describe('纪要 —— 团队主动沉淀,本身不产生责任', () => { it('新建的决议一律待登记', () => { expect(base.resolutions.map((r) => r.state)).toEqual(['open']); expect(registeredWorkflowOf(base, 'r1')).toBeUndefined(); }); it('决议只增不改 —— 追加不动既有条目', () => { const next = addResolution(base, { id: 'r2', text: '新增一条' }, '2026-07-27T03:00:00.000Z'); expect(next.resolutions.map((r) => r.id)).toEqual(['r1', 'r2']); expect(next.resolutions[0]).toEqual(base.resolutions[0]); expect(next.updatedAt).toBe('2026-07-27T03:00:00.000Z'); }); }); describe('决议 → 登记起单:登记人即来源', () => { const at = '2026-07-27T04:00:00.000Z'; const registered = markRegistered(base, 'r1', { workflowId: 'wf-9', byId: 's-pm', at })!; it('登记落笔记下工作流与登记人', () => { expect(registered.resolutions[0]).toMatchObject({ state: 'registered', workflowId: 'wf-9', registeredById: 's-pm', registeredAt: at, }); }); it('已登记的决议可被查出它起的那条流 —— 用例层据此拒绝重复起单', () => { expect(registeredWorkflowOf(registered, 'r1')).toBe('wf-9'); }); it('不存在的决议返回 undefined,不静默改别的条目', () => { expect(markRegistered(base, 'r-nope', { workflowId: 'wf-9', byId: 's-pm', at })).toBeUndefined(); }); });