Integrate unfinished server-rs refactor worklists
This commit is contained in:
@@ -4,10 +4,18 @@ import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { beforeEach, expect, test, vi } from 'vitest';
|
||||
|
||||
import { AnimationState, WorldType, type GameState } from '../../types';
|
||||
import {
|
||||
AnimationState,
|
||||
WorldType,
|
||||
type GameState,
|
||||
type StoryMoment,
|
||||
} from '../../types';
|
||||
import { RpgRuntimeShell } from './RpgRuntimeShell';
|
||||
import type { RpgRuntimeShellProps } from './types';
|
||||
|
||||
const noop = () => {};
|
||||
const asyncFalse = async () => false;
|
||||
|
||||
vi.mock('../auth/AuthUiContext', () => ({
|
||||
useAuthUi: () => null,
|
||||
}));
|
||||
@@ -34,7 +42,7 @@ vi.mock('./useRpgRuntimeShellViewModel', () => ({
|
||||
shouldMountNpcModals: false,
|
||||
visibleGameState: mockVisibleGameState,
|
||||
visibleCurrentStory: {
|
||||
storyText: '测试故事',
|
||||
text: '测试故事',
|
||||
options: [],
|
||||
},
|
||||
sceneTransitionPhase: 'idle',
|
||||
@@ -97,22 +105,23 @@ function createGameState(
|
||||
description: '测试角色',
|
||||
backstory: '测试背景',
|
||||
personality: '冷静',
|
||||
motivation: '完成测试',
|
||||
combatStyle: '均衡',
|
||||
role: '主角',
|
||||
avatar: '',
|
||||
portrait: '',
|
||||
imageSrc: '',
|
||||
initialAffinity: 0,
|
||||
relationshipHooks: [],
|
||||
tags: [],
|
||||
assetFolder: '',
|
||||
assetVariant: '',
|
||||
attributes: {
|
||||
strength: 5,
|
||||
agility: 5,
|
||||
intelligence: 5,
|
||||
spirit: 5,
|
||||
},
|
||||
backstoryReveal: {
|
||||
publicSummary: '测试',
|
||||
privateChatUnlockAffinity: 60,
|
||||
chapters: [],
|
||||
},
|
||||
skills: [],
|
||||
initialItems: [],
|
||||
adventureOpenings: {},
|
||||
},
|
||||
runtimeMode,
|
||||
runtimePersistenceDisabled: runtimePersistenceDisabled ?? false,
|
||||
@@ -176,14 +185,15 @@ function buildProps(
|
||||
runtimePersistenceDisabled?: boolean,
|
||||
): RpgRuntimeShellProps {
|
||||
const gameState = createGameState(runtimeMode, runtimePersistenceDisabled);
|
||||
const currentStory: StoryMoment = {
|
||||
text: '测试故事',
|
||||
options: [],
|
||||
};
|
||||
mockVisibleGameState = gameState;
|
||||
return {
|
||||
session: {
|
||||
gameState,
|
||||
currentStory: {
|
||||
storyText: '测试故事',
|
||||
options: [],
|
||||
},
|
||||
currentStory,
|
||||
isLoading: false,
|
||||
aiError: null,
|
||||
bottomTab: 'adventure',
|
||||
@@ -201,36 +211,66 @@ function buildProps(
|
||||
exitNpcChat: () => false,
|
||||
handleMapTravelToScene: () => false,
|
||||
npcUi: {
|
||||
isNpcModalOpen: false,
|
||||
currentNpcEncounter: null,
|
||||
selectedNpc: null,
|
||||
isGeneratingNpcResponse: false,
|
||||
npcResponseError: null,
|
||||
generatedNpcText: '',
|
||||
npcResponseOptions: [],
|
||||
selectedOptionId: null,
|
||||
tradeModal: null,
|
||||
giftModal: null,
|
||||
recruitModal: null,
|
||||
setTradeMode: noop,
|
||||
selectTradeNpcItem: noop,
|
||||
selectTradePlayerItem: noop,
|
||||
setTradeQuantity: noop,
|
||||
closeTradeModal: noop,
|
||||
confirmTrade: noop,
|
||||
selectGiftItem: noop,
|
||||
closeGiftModal: noop,
|
||||
confirmGift: noop,
|
||||
selectRecruitRelease: noop,
|
||||
closeRecruitModal: noop,
|
||||
confirmRecruit: noop,
|
||||
},
|
||||
characterChatUi: {
|
||||
isCharacterChatModalOpen: false,
|
||||
activeCharacter: null,
|
||||
modal: null,
|
||||
openChat: noop,
|
||||
closeChat: noop,
|
||||
setDraft: noop,
|
||||
useSuggestion: noop,
|
||||
refreshSuggestions: noop,
|
||||
sendDraft: noop,
|
||||
},
|
||||
inventoryUi: {
|
||||
isInventoryOpen: false,
|
||||
useInventoryItem: asyncFalse,
|
||||
equipInventoryItem: asyncFalse,
|
||||
unequipItem: asyncFalse,
|
||||
playerCurrency: 0,
|
||||
currencyText: '0',
|
||||
backpackItems: [],
|
||||
equipmentSlots: [],
|
||||
forgeRecipes: [],
|
||||
craftRecipe: asyncFalse,
|
||||
dismantleItem: asyncFalse,
|
||||
reforgeItem: asyncFalse,
|
||||
},
|
||||
battleRewardUi: {
|
||||
isRewardModalOpen: false,
|
||||
rewards: [],
|
||||
reward: null,
|
||||
dismiss: noop,
|
||||
},
|
||||
questUi: {
|
||||
isQuestPanelOpen: false,
|
||||
acknowledgeQuestCompletion: noop,
|
||||
claimQuestReward: () => null,
|
||||
},
|
||||
npcChatQuestOfferUi: {
|
||||
isOfferModalOpen: false,
|
||||
pendingQuest: null,
|
||||
replacePendingOffer: () => false,
|
||||
abandonPendingOffer: () => false,
|
||||
acceptPendingOffer: () => null,
|
||||
},
|
||||
goalUi: {
|
||||
isGoalPanelOpen: false,
|
||||
entries: [],
|
||||
goalStack: {
|
||||
northStarGoal: null,
|
||||
activeGoal: null,
|
||||
immediateStepGoal: null,
|
||||
supportGoals: [],
|
||||
},
|
||||
pulse: null,
|
||||
dismissPulse: noop,
|
||||
},
|
||||
},
|
||||
entry: {
|
||||
|
||||
Reference in New Issue
Block a user