Files
Genarrative/src/services/storyEngine/consequenceLedger.test.ts
kdletters cbc27bad4a
Some checks failed
CI / verify (push) Has been cancelled
init with react+axum+spacetimedb
2026-04-26 18:06:23 +08:00

32 lines
896 B
TypeScript

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');
});
});