Rework story engine flow and reorganize project docs
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
52
src/services/storyEngine/campEventDirector.test.ts
Normal file
52
src/services/storyEngine/campEventDirector.test.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import type { ChapterState, CompanionArcState, JourneyBeat } from '../../types';
|
||||
import { buildCampEvent, evaluateCampEventOpportunity } from './campEventDirector';
|
||||
|
||||
describe('campEventDirector', () => {
|
||||
it('opens camp events during camp/recovery beats or conflicted arcs', () => {
|
||||
const chapterState: ChapterState = {
|
||||
id: 'chapter-1',
|
||||
title: '封桥旧案·余波',
|
||||
theme: '封桥旧案',
|
||||
primaryThreadIds: ['thread-1'],
|
||||
stage: 'aftermath',
|
||||
chapterSummary: '旧案留下的余波正在扩散。',
|
||||
};
|
||||
const journeyBeat: JourneyBeat = {
|
||||
id: 'beat-camp',
|
||||
beatType: 'camp',
|
||||
title: '营火边的休整',
|
||||
triggerThreadIds: ['thread-1'],
|
||||
recommendedSceneIds: ['scene-1'],
|
||||
emotionalGoal: '让角色先缓口气。',
|
||||
};
|
||||
const companionArcStates: CompanionArcState[] = [
|
||||
{
|
||||
characterId: 'archer-hero',
|
||||
arcTheme: '旧案',
|
||||
currentStage: 'bonded',
|
||||
activeConflictTags: [],
|
||||
pendingEventIds: ['event-1'],
|
||||
resolvedEventIds: [],
|
||||
},
|
||||
];
|
||||
|
||||
expect(
|
||||
evaluateCampEventOpportunity({
|
||||
state: {} as never,
|
||||
chapterState,
|
||||
journeyBeat,
|
||||
companionArcStates,
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
buildCampEvent({
|
||||
state: {} as never,
|
||||
chapterState,
|
||||
journeyBeat,
|
||||
companionArcStates,
|
||||
})?.title,
|
||||
).toBe('营火边的私话');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user