fe49fef1ad
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 55s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m12s
CI/CD Pipeline / Validate - Code Quality (push) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (push) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (push) Has been cancelled
CI/CD Pipeline / Unit Tests (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (push) Has been cancelled
CI/CD Pipeline / Build Staging API Image (push) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (push) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (push) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (push) Has been cancelled
CI/CD Pipeline / Build Production API Image (push) Has been cancelled
CI/CD Pipeline / Build Production Web Image (push) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (push) Has been cancelled
CI/CD Pipeline / Deploy Production (push) Has been cancelled
CI/CD Pipeline / Production Browser E2E (push) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (push) Has been cancelled
CI/CD Pipeline / Canary Release to Production (push) Has been cancelled
CI/CD Pipeline / CI Gate (push) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API 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 / ACR Image Cleanup (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
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (push) Failing after 577h31m12s
CI/CD Pipeline / Frontend Lint (push) Failing after 577h31m33s
CI/CD Pipeline / PR Build Web Image (push) Failing after 577h31m14s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 577h32m24s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 577h32m28s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 577h32m30s
CI/CD Pipeline / PR Build API Image (push) Failing after 578h5m4s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 578h6m14s
- Step2/Step4 auto-save via useDraftAutoSave (GET-merge-PUT, serial queue)
- useDraftAutoSave: failed saves preserve patch with exponential backoff retry
- Step6 cover requests include full title_config
- Step7 create task: source_edit_plan_id, title_config, cover_url priority
- Polling switched to GET /generation/tasks/{task_id} with proper error handling
- getGenerationTaskResults retries before treating as failure
- Removed 7 ghost API functions (non-existent backend routes)
- BGM presets path updated to /templates/{id}/editor/bgm/presets
- Type alignment for BatchGenerationTaskResponse
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import { describe, expect, it, vi, beforeEach } from "vitest"
|
|
import { getBgmPresets } from "@/api/bgm"
|
|
|
|
const mockGet = vi.fn()
|
|
const mockPost = vi.fn()
|
|
const mockPut = vi.fn()
|
|
const mockDelete = vi.fn()
|
|
const mockPatch = vi.fn()
|
|
|
|
vi.mock("@/api/client", () => ({
|
|
default: {
|
|
get: (...args: unknown[]) => mockGet(...args),
|
|
post: (...args: unknown[]) => mockPost(...args),
|
|
put: (...args: unknown[]) => mockPut(...args),
|
|
delete: (...args: unknown[]) => mockDelete(...args),
|
|
patch: (...args: unknown[]) => mockPatch(...args),
|
|
},
|
|
}))
|
|
|
|
vi.mock("antd", () => ({ message: { error: vi.fn(), success: vi.fn() } }))
|
|
vi.mock("@/store/authStore", () => ({ useAuthStore: { getState: vi.fn(() => ({})) } }))
|
|
|
|
describe("bgm API", () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks()
|
|
mockGet.mockResolvedValue({ data: { success: true, items: [] } })
|
|
mockPost.mockResolvedValue({ data: { success: true, items: [] } })
|
|
mockPut.mockResolvedValue({ data: { success: true, items: [] } })
|
|
mockDelete.mockResolvedValue({ data: { success: true, items: [] } })
|
|
mockPatch.mockResolvedValue({ data: { success: true, items: [] } })
|
|
})
|
|
|
|
describe("getBgmPresets", () => {
|
|
it("should resolve successfully", async () => {
|
|
await expect(getBgmPresets("test-template", { category: "test" })).resolves.not.toThrow()
|
|
})
|
|
|
|
it("should reject on API error", async () => {
|
|
mockGet.mockRejectedValue(new Error("Network error"))
|
|
mockPost.mockRejectedValue(new Error("Network error"))
|
|
mockPut.mockRejectedValue(new Error("Network error"))
|
|
mockDelete.mockRejectedValue(new Error("Network error"))
|
|
mockPatch.mockRejectedValue(new Error("Network error"))
|
|
|
|
await expect(getBgmPresets("test-template", { category: "test" })).rejects.toThrow()
|
|
})
|
|
})
|
|
})
|