1
This commit is contained in:
51
packages/shared/src/contracts/rpgRuntimeContracts.test.ts
Normal file
51
packages/shared/src/contracts/rpgRuntimeContracts.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import {
|
||||
CharacterChatReplyRequest,
|
||||
QUEST_NARRATIVE_TYPES,
|
||||
RuntimeStoryActionRequest,
|
||||
SERVER_RUNTIME_FUNCTION_IDS,
|
||||
TASK6_RUNTIME_FUNCTION_IDS,
|
||||
} from './story';
|
||||
import { TASK5_RUNTIME_OPTION_SCOPES } from './rpgRuntimeStoryAction';
|
||||
import type { RuntimeStoryStateRequest } from './rpgRuntimeStoryState';
|
||||
|
||||
describe('RPG runtime shared contract façades', () => {
|
||||
test('旧 story façade 继续导出 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('旧 story façade 继续导出 chat 与 quest assist 契约', () => {
|
||||
const payload: CharacterChatReplyRequest = {
|
||||
worldType: 'WUXIA',
|
||||
playerCharacter: {},
|
||||
targetCharacter: {},
|
||||
storyHistory: [],
|
||||
context: {},
|
||||
conversationHistory: [],
|
||||
conversationSummary: '测试摘要',
|
||||
playerMessage: '近况如何?',
|
||||
targetStatus: {},
|
||||
};
|
||||
|
||||
const stateRequest: RuntimeStoryStateRequest = {
|
||||
sessionId: 'runtime-session-2',
|
||||
};
|
||||
|
||||
expect(payload.playerMessage).toBe('近况如何?');
|
||||
expect(stateRequest.sessionId).toBe('runtime-session-2');
|
||||
expect(QUEST_NARRATIVE_TYPES).toContain('relationship');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user