feat(short-drama-agent-front): 完善分镜审核与制作准备流程

This commit is contained in:
GJ committed 2026-10-19 21:59:22 +08:00
1 parent c4b43b9725
commit 1da56e0d46
72 files changed
+2801 -528

No files matched your search

@@ -0,0 +1,31 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { checkPipeline } from '@/features/production/useAdvancedProduction'
import { productionApi } from '@/features/production/api'
import { generationConfigApi } from '@/features/generation-config/api'
import { projectsApi } from '@/features/projects/api'
import { subjectImagesApi } from '@/features/subject-images/api'
import { storyboardApi } from '@/features/storyboard/api'
afterEach(() => { vi.restoreAllMocks(); vi.unstubAllGlobals() })
describe('制作计划之前的正式分镜检查', () => {
it('入口未通过时不查询制作计划,也不调用生成接口', async () => {
vi.stubGlobal('fetch', vi.fn<typeof fetch>().mockImplementation(async () => new Response(JSON.stringify({ data: { ready: false, reason: '请先完成分镜审核', hasStoryboardValidation: true, storyboardValid: true, derivedAssets: { shotCount: 1, directionCount: 0, directionCoverage: 0, visualStateCount: 0, visualStateCoverage: 0 } } }))))
vi.spyOn(generationConfigApi, 'profile').mockResolvedValue(null)
vi.spyOn(projectsApi, 'detail').mockResolvedValue({ id: 'p' } as never)
vi.spyOn(projectsApi, 'checkpoints').mockResolvedValue([])
vi.spyOn(subjectImagesApi, 'listForms').mockResolvedValue([])
vi.spyOn(productionApi, 'status').mockResolvedValue({ projectId: 'p' } as never)
const plan = vi.spyOn(productionApi, 'plan').mockRejectedValue(new Error('不应该进入制作计划'))
await expect(checkPipeline('p')).rejects.toThrow('请先完成分镜审核')
expect(plan).not.toHaveBeenCalled()
})
it('设计覆盖完整但已经过期时仍不进入制作计划', async () => {
vi.stubGlobal('fetch', vi.fn<typeof fetch>().mockImplementation(async () => new Response(JSON.stringify({ data: { ready: true, derivedAssets: { shotCount: 1 } } }))))
vi.spyOn(projectsApi, 'detail').mockResolvedValue({ id: 'p', episodes: [{ episode: 1 }] } as never)
vi.spyOn(storyboardApi, 'directions').mockResolvedValue({ projectId: 'p', episodeNo: 1, shotCount: 1, directionCount: 1, staleCount: 1, coverage: 1, beats: [] })
vi.spyOn(storyboardApi, 'visualStates').mockResolvedValue({ projectId: 'p', episodeNo: 1, shotCount: 1, visualStateCount: 1, staleCount: 0, coverage: 1, beats: [] })
const plan = vi.spyOn(productionApi, 'plan')
await expect(checkPipeline('p')).rejects.toThrow('过期')
expect(plan).not.toHaveBeenCalled()
})
})