1
This commit is contained in:
@@ -3,6 +3,7 @@ import { expect, test } from 'vitest';
|
||||
import type { CustomWorldAgentSessionSnapshot } from '../../../packages/shared/src/contracts/customWorldAgent';
|
||||
import {
|
||||
buildRpgCreationPreviewFromResultPreview,
|
||||
buildRpgCreationPreviewFromResultView,
|
||||
buildRpgCreationPreviewFromSession,
|
||||
} from './rpgCreationPreviewAdapter';
|
||||
|
||||
@@ -211,7 +212,7 @@ test('buildRpgCreationPreviewFromSession prefers server result preview', () => {
|
||||
expect(profile?.playableNpcs).toEqual([]);
|
||||
});
|
||||
|
||||
test('buildRpgCreationPreviewFromSession falls back to draft legacy result profile', () => {
|
||||
test('buildRpgCreationPreviewFromSession no longer reads draft legacy result profile', () => {
|
||||
const profile = buildRpgCreationPreviewFromSession({
|
||||
...sessionWithPreview,
|
||||
resultPreview: null,
|
||||
@@ -226,11 +227,36 @@ test('buildRpgCreationPreviewFromSession falls back to draft legacy result profi
|
||||
},
|
||||
});
|
||||
|
||||
expect(profile?.name).toBe('草稿内嵌结果页');
|
||||
expect(profile?.summary).toBe(
|
||||
'resultPreview 缺失时继续使用 draft 内嵌的结果页快照。',
|
||||
);
|
||||
expect(profile?.id).toBe('legacy-result-profile-1');
|
||||
expect(profile).toBeNull();
|
||||
});
|
||||
|
||||
test('buildRpgCreationPreviewFromResultView consumes backend-selected profile', () => {
|
||||
const profile = buildRpgCreationPreviewFromResultView({
|
||||
session: {
|
||||
...sessionWithPreview,
|
||||
resultPreview: null,
|
||||
},
|
||||
profile: {
|
||||
...sessionWithPreview.resultPreview!.preview,
|
||||
id: 'backend-selected-profile-1',
|
||||
name: '后端结果页真相',
|
||||
summary: 'legacy 兼容只允许在后端 result-view 内完成。',
|
||||
},
|
||||
profileSource: 'draft_profile',
|
||||
targetStage: 'custom-world-result',
|
||||
generationViewSource: null,
|
||||
resultViewSource: 'agent-draft',
|
||||
canAutosaveLibrary: true,
|
||||
canSyncResultProfile: true,
|
||||
publishReady: false,
|
||||
canEnterWorld: false,
|
||||
blockerCount: 0,
|
||||
recoveryAction: 'open_result',
|
||||
});
|
||||
|
||||
expect(profile?.name).toBe('后端结果页真相');
|
||||
expect(profile?.summary).toBe('legacy 兼容只允许在后端 result-view 内完成。');
|
||||
expect(profile?.id).toBe('backend-selected-profile-1');
|
||||
});
|
||||
|
||||
test('buildRpgCreationPreviewFromSession does not treat draftProfile as runtime profile', () => {
|
||||
|
||||
Reference in New Issue
Block a user