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

56 lines
2.2 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildEncounterVisibilitySlice, createEmptyStoryEngineMemoryState } from './visibilityEngine';
describe('buildEncounterVisibilitySlice', () => {
it('keeps full backstory facts out of first contact visibility', () => {
const slice = buildEncounterVisibilitySlice({
narrativeProfile: {
publicMask: '她只说自己还在守桥。',
firstContactMask: '她会先把话题拉回桥和风声。',
visibleLine: '她盯着桥口与来路的每一次波动。',
hiddenLine: '她真正盯着的是封桥旧令背后的名字。',
contradiction: '嘴上说只守桥,提到名单时却明显收紧语气。',
debtOrBurden: '她还在替旧命令续着一口气。',
taboo: '封桥令',
immediatePressure: '裂潮又在逼近桥口,她不敢轻易放开通路。',
relatedThreadIds: ['thread-1'],
relatedScarIds: ['scar-1'],
reactionHooks: ['名单', '旧哨火'],
},
backstoryReveal: {
publicSummary: '她只承认自己还在守桥。',
chapters: [
{
id: 'surface',
title: '表层来意',
affinityRequired: 0,
teaser: '她只说桥还不能放开。',
content: '她总先谈桥和路。',
contextSnippet: '桥还不能放开。',
},
{
id: 'truth',
title: '最终底牌',
affinityRequired: 90,
teaser: '那夜真正下封桥令的人还没有露面。',
content: '她知道封桥命令真正的源头。',
contextSnippet: '封桥命令另有来头。',
},
],
},
disclosureStage: 'guarded',
isFirstMeaningfulContact: true,
seenBackstoryChapterIds: [],
storyEngineMemory: createEmptyStoryEngineMemoryState(),
activeThreadIds: ['thread-1'],
});
expect(slice.sayableFactIds).toContain('publicMask');
expect(slice.sayableFactIds).toContain('firstContactMask');
expect(slice.sayableFactIds).not.toContain('hiddenLine');
expect(slice.forbiddenFactIds).toContain('hiddenLine');
expect(slice.forbiddenFactIds).toContain('chapter:truth');
});
});