46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { describe, expect, test } from 'vitest';
|
|
|
|
import type { CharacterChatReplyRequest } from './rpgRuntimeChat';
|
|
import { QUEST_NARRATIVE_TYPES } from './rpgRuntimeQuestAssist';
|
|
import {
|
|
SERVER_RUNTIME_FUNCTION_IDS,
|
|
TASK5_RUNTIME_OPTION_SCOPES,
|
|
TASK6_RUNTIME_FUNCTION_IDS,
|
|
} from './rpgRuntimeStoryAction';
|
|
import { type RuntimeStoryActionRequest } from './rpgRuntimeStoryState';
|
|
|
|
describe('RPG runtime shared contracts', () => {
|
|
test('拆分后的 runtime story action 契约继续导出常量与类型', () => {
|
|
expect(SERVER_RUNTIME_FUNCTION_IDS).toContain('npc_chat');
|
|
expect(TASK6_RUNTIME_FUNCTION_IDS).toContain('npc_trade');
|
|
expect(TASK5_RUNTIME_OPTION_SCOPES).toEqual(['story', 'combat', 'npc']);
|
|
|
|
const request: RuntimeStoryActionRequest = {
|
|
sessionId: 'runtime-session-1',
|
|
action: {
|
|
type: 'story_choice',
|
|
functionId: 'npc_chat',
|
|
},
|
|
};
|
|
|
|
expect(request.action.functionId).toBe('npc_chat');
|
|
});
|
|
|
|
test('拆分后的 chat 与 quest assist 契约继续导出运行时类型', () => {
|
|
const payload: CharacterChatReplyRequest = {
|
|
worldType: 'WUXIA',
|
|
playerCharacter: {},
|
|
targetCharacter: {},
|
|
storyHistory: [],
|
|
context: {},
|
|
conversationHistory: [],
|
|
conversationSummary: '测试摘要',
|
|
playerMessage: '近况如何?',
|
|
targetStatus: {},
|
|
};
|
|
|
|
expect(payload.playerMessage).toBe('近况如何?');
|
|
expect(QUEST_NARRATIVE_TYPES).toContain('relationship');
|
|
});
|
|
});
|