feat: unify phase one creation flow
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/* @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.getByText('当前拼图信息')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user