Files
Genarrative/src/components/unified-creation/UnifiedGenerationPage.test.tsx
高物 27b30f974b Update spacetime-client bindings and frontend
Large update across server and web clients: regenerated/added many spacetime-client module bindings and input types (including new delete/work_delete input types and numerous procedure/reducer files), updates to server-rs API modules (bark_battle, jump_hop, wooden_fish, auth, module-runtime and shared contracts), and fixes in module-runtime behavior and domain logic. Frontend changes include new/updated components and tests (creative audio helpers, bark-battle/jump-hop/wooden-fish clients and views, unified generation pages, RPG entry views, and runtime shells), plus CSS and service updates. Documentation and operational notes updated (.hermes pitfalls and multiple PRD/docs) to cover daily-task refresh, banner asset fallback, recommend-key bug, and other platform behaviors. Tests and verification steps added/updated alongside these changes.
2026-06-04 22:44:19 +08:00

74 lines
2.2 KiB
TypeScript

/* @vitest-environment jsdom */
import { render, screen } from '@testing-library/react';
import { describe, expect, test } from 'vitest';
import type { CustomWorldGenerationProgress } from '../../../packages/shared/src/contracts/runtime';
import { UnifiedGenerationPage } from './UnifiedGenerationPage';
function createProgress(): CustomWorldGenerationProgress {
return {
phaseId: 'puzzle-cover-image',
phaseLabel: '生成拼图首图',
phaseDetail: '正在生成图片。',
batchLabel: '生成拼图首图',
overallProgress: 36,
completedWeight: 36,
totalWeight: 100,
elapsedMs: 12_000,
estimatedRemainingMs: 30_000,
activeStepIndex: 0,
steps: [
{
id: 'puzzle-cover-image',
label: '生成拼图首图',
detail: '正在生成图片。',
completed: 0.36,
total: 1,
status: 'active',
},
],
};
}
describe('UnifiedGenerationPage', () => {
test('按玩法下发统一生成页文案并透传进度', () => {
render(
<UnifiedGenerationPage
playId="puzzle"
settingText="一只发光的纸船"
progress={createProgress()}
isGenerating
onBack={() => {}}
onEditSetting={() => {}}
onRetry={() => {}}
/>,
);
expect(document.body.textContent).toContain('拼图图片生成进度');
expect(screen.getByText('图片生成中')).toBeTruthy();
expect(screen.getAllByText('生成拼图首图').length).toBeGreaterThan(0);
expect(screen.queryByText('当前拼图信息')).toBeNull();
expect(screen.queryByText('一只发光的纸船')).toBeNull();
});
test('jump-hop generation page uses unified copy', () => {
render(
<UnifiedGenerationPage
playId="jump-hop"
settingText="云端糖果塔"
progress={createProgress()}
isGenerating
onBack={() => {}}
onEditSetting={() => {}}
onRetry={() => {}}
/>,
);
expect(document.body.textContent).toContain('跳一跳草稿生成进度');
expect(screen.getByText('素材生成中')).toBeTruthy();
expect(screen.queryByText('当前跳一跳信息')).toBeNull();
expect(screen.queryByText('云端糖果塔')).toBeNull();
});
});