280db0b862
CI Build & Deploy Pipeline / Staging E2E Tests (push) Failing after 1m14s
CI Build & Deploy Pipeline / Production Browser E2E (push) Failing after 1419h8m25s
CI Build & Deploy Pipeline / Build Production Worker Image (push) Failing after 1419h8m28s
CI Build & Deploy Pipeline / Build Production Web Image (push) Failing after 1419h8m29s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 1419h11m0s
CI Build & Deploy Pipeline / Build Production API Image (push) Failing after 1419h8m29s
CI Build & Deploy Pipeline / Build Staging API Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Staging Web Image (push) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (push) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (push) Failing after 1419h40m33s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been skipped
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (push) Has been skipped
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
103 lines
2.6 KiB
TypeScript
103 lines
2.6 KiB
TypeScript
import { describe, expect, it, vi } from "vitest"
|
|
import { render } from "@testing-library/react"
|
|
import GenerationProgressModal from "@/pages/editing-planner/components/GenerationProgressModal"
|
|
|
|
const baseProps = {
|
|
open: true,
|
|
voiceoverDuration: null,
|
|
estimatedDuration: 60,
|
|
onDurationChange: vi.fn(),
|
|
onGenerate: vi.fn(),
|
|
task: null,
|
|
submitting: false,
|
|
onCancel: vi.fn(),
|
|
onRetry: vi.fn(),
|
|
onClose: vi.fn(),
|
|
}
|
|
|
|
describe("GenerationProgressModal", () => {
|
|
it("should render setup phase", () => {
|
|
const { container } = render(<GenerationProgressModal {...baseProps} phase="setup" />)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
|
|
it("should render progress phase without task", () => {
|
|
const { container } = render(<GenerationProgressModal {...baseProps} phase="progress" />)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
|
|
it("should render progress phase with task data", () => {
|
|
const { container } = render(
|
|
<GenerationProgressModal
|
|
{...baseProps}
|
|
phase="progress"
|
|
task={
|
|
{
|
|
id: "task-123",
|
|
status: "generating_video",
|
|
progress: 50,
|
|
current_step: "generating_video",
|
|
user_message: "正在生成视频",
|
|
} as any
|
|
}
|
|
/>,
|
|
)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
|
|
it("should render completed phase", () => {
|
|
const { container } = render(
|
|
<GenerationProgressModal
|
|
{...baseProps}
|
|
phase="completed"
|
|
task={{ id: "task-1", status: "completed", progress: 100 } as any}
|
|
/>,
|
|
)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
|
|
it("should render failed phase with retry", () => {
|
|
const { container } = render(
|
|
<GenerationProgressModal
|
|
{...baseProps}
|
|
phase="failed"
|
|
task={
|
|
{
|
|
id: "task-1",
|
|
status: "failed",
|
|
progress: 30,
|
|
error_message: "生成失败",
|
|
retryable: true,
|
|
} as any
|
|
}
|
|
/>,
|
|
)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
|
|
it("should render failed phase without retry", () => {
|
|
const { container } = render(
|
|
<GenerationProgressModal
|
|
{...baseProps}
|
|
phase="failed"
|
|
task={
|
|
{
|
|
id: "task-1",
|
|
status: "failed",
|
|
progress: 30,
|
|
retryable: false,
|
|
} as any
|
|
}
|
|
/>,
|
|
)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
|
|
it("should not render when closed", () => {
|
|
const { container } = render(
|
|
<GenerationProgressModal {...baseProps} phase="setup" open={false} />,
|
|
)
|
|
expect(container).toBeTruthy()
|
|
})
|
|
})
|