import { describe, expect, it } from 'vitest'; import { appendConsequenceRecord, buildConsequenceLedgerSummary } from './consequenceLedger'; describe('consequenceLedger', () => { it('builds consequence records from signals and reactions', () => { const ledger = appendConsequenceRecord({ existing: [], signals: [ { id: 'signal-1', signalType: 'accept_contract', threadIds: ['thread-1'], }, ], reactions: [ { id: 'reaction-1', characterId: 'archer-hero', reactionType: 'disapprove', reason: '她对这一步明显有保留。', relatedThreadIds: ['thread-1'], createdAt: new Date().toISOString(), }, ], }); expect(ledger.length).toBe(2); expect(buildConsequenceLedgerSummary(ledger)).toContain('accept_contract'); }); });