test(PageHead): 添加smoke test
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 58s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m32s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m29s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
AI Code Review / AI Code Review (pull_request) Successful in 1m29s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m19s
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 1m18s
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 1m3s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
PR Automation / Auto Approve on CI Green (pull_request) Successful in 1m47s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 35s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m42s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 4m22s
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled

This commit is contained in:
2026-07-30 07:11:13 +08:00
parent df3e282d30
commit 9c75503a80
@@ -0,0 +1,37 @@
import PageHead from "./index"
import type { BreadcrumbItem, PageHeadProps } from "./types"
import { generateBreadcrumb } from "./utils"
import { ROUTE_TITLE_MAP } from "./constants"
describe("PageHead", () => {
it("模块可正常导入", () => {
expect(PageHead).toBeDefined()
})
it("类型导出正常", () => {
const item: BreadcrumbItem = { label: "测试" }
expect(item.label).toBe("测试")
const props: PageHeadProps = { title: "测试页面" }
expect(props.title).toBe("测试页面")
})
it("generateBreadcrumb 生成首页面包屑", () => {
const result = generateBreadcrumb("/app/dashboard")
expect(result.length).toBe(1)
expect(result[0].label).toBe("首页")
})
it("generateBreadcrumb 生成多级面包屑", () => {
const result = generateBreadcrumb("/app/voices")
expect(result.length).toBeGreaterThanOrEqual(2)
expect(result[0].label).toBe("首页")
expect(result[result.length - 1].label).toBe("配音库")
})
it("ROUTE_TITLE_MAP 包含主要路由", () => {
expect(ROUTE_TITLE_MAP["/app/dashboard"]).toBe("首页")
expect(ROUTE_TITLE_MAP["/app/generate"]).toBe("智能剪辑")
})
})