This commit is contained in:
31
src/services/storyEngine/consequenceLedger.test.ts
Normal file
31
src/services/storyEngine/consequenceLedger.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user