53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
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('营火边的私话');
|
|
});
|
|
});
|