Files
xiaoxia-saas/apps/web/src/test/components/GenerateHeader.test.tsx
T
xiaoxia 9a51cad137
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Successful in 48s
CI/CD Pipeline / Validate - Code Quality (push) Failing after 2m24s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m25s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m27s
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m8s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m16s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 1m20s
CI/CD Pipeline / Integration Tests (push) Successful in 3m53s
CI/CD Pipeline / Unit Tests (push) Failing after 7m53s
CI/CD Pipeline / Build Staging API Image (push) Successful in 11m29s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m13s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 26s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1m3s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m15s
refactor: GeneratePage Phase 2 — 7个Step组件化 + 自定义Hook(2682→485行) (#803)
2026-07-24 17:20:59 +08:00

32 lines
1.1 KiB
TypeScript

/**
* GenerateHeader 组件单元测试
* 同时 import GeneratePage 主组件,确保 vitest related 模式
* 能匹配到 generate 目录下所有文件的改动
*/
import { render, screen } from "@testing-library/react"
import { describe, it, expect } from "vitest"
import GenerateHeader from "@/pages/generate/components/GenerateHeader"
// 引入主组件以建立依赖链,让 vitest related 覆盖整个 generate 目录
import "@/pages/generate/GeneratePage"
describe("GenerateHeader", () => {
it("should render title and description", () => {
render(<GenerateHeader />)
expect(screen.getByText("智能剪辑")).toBeInTheDocument()
expect(screen.getByText("快速生成短视频,支持多种风格和素材组合")).toBeInTheDocument()
})
it("should not show edit plan badge by default", () => {
render(<GenerateHeader />)
expect(screen.queryByText("来自模板草稿")).not.toBeInTheDocument()
})
it("should show edit plan badge when fromEditPlan is true", () => {
render(<GenerateHeader fromEditPlan />)
expect(screen.getByText("🎬 来自模板草稿")).toBeInTheDocument()
})
})