1
This commit is contained in:
40
src/components/rpg-entry/rpgEntryShared.test.ts
Normal file
40
src/components/rpg-entry/rpgEntryShared.test.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import type { CustomWorldProfile } from '../../types';
|
||||
import {
|
||||
normalizeRpgEntryAgentBackedProfile,
|
||||
stringifyRpgEntryAgentBackedProfile,
|
||||
} from './rpgEntryShared';
|
||||
|
||||
describe('rpgEntryShared profile save boundary', () => {
|
||||
it('does not rewrite settingText from creatorIntent on the frontend', () => {
|
||||
const profile = {
|
||||
id: 'cwprof_test',
|
||||
settingText: '结果页用户正在编辑的草稿文案',
|
||||
creatorIntent: {
|
||||
worldHook: '海图会在午夜改写群岛航路',
|
||||
playerPremise: '玩家是失忆领航员',
|
||||
openingSituation: '正在禁航区醒来',
|
||||
themeKeywords: ['海雾'],
|
||||
toneDirectives: ['悬疑'],
|
||||
coreConflicts: ['议会隐瞒沉船真相'],
|
||||
keyCharacters: [
|
||||
{
|
||||
name: '顾潮音',
|
||||
role: '守灯人',
|
||||
relationToPlayer: '旧识',
|
||||
hiddenHook: '掌握伪造海图',
|
||||
},
|
||||
],
|
||||
iconicElements: ['会说谎的罗盘'],
|
||||
},
|
||||
} as CustomWorldProfile;
|
||||
|
||||
expect(normalizeRpgEntryAgentBackedProfile(profile)).toBe(profile);
|
||||
expect(
|
||||
JSON.parse(stringifyRpgEntryAgentBackedProfile(profile)),
|
||||
).toMatchObject({
|
||||
settingText: '结果页用户正在编辑的草稿文案',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user