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

34 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import type { ThreadContract } from '../../types';
import { buildNarrativeDocument, compileDocumentKnowledgeFacts } from './documentCarrierCompiler';
describe('documentCarrierCompiler', () => {
it('builds a document carrier and related knowledge fact', () => {
const contract: ThreadContract = {
id: 'thread-contract:thread-1',
threadId: 'thread-1',
issuerActorId: 'npc-1',
narrativeType: 'investigation',
currentStepId: 'thread-contract:thread-1:step_1',
visibleStage: 0,
steps: [
{
id: 'step-1',
title: '追上旧案线索',
revealText: '先去断桥旧哨看清楚残痕。',
completionSignalIds: ['inspect_scene:scene-1'],
optionalFactIds: ['fact-1'],
},
],
followupThreadIds: [],
};
const document = buildNarrativeDocument({ contract, titleSeed: '断桥调查简札' });
const facts = compileDocumentKnowledgeFacts({ document, contract });
expect(document.category).toBe('文书');
expect(facts[0]?.content).toContain('断桥旧哨');
});
});