fix(short-drama-agent-front): 修复代码格式检查问题

This commit is contained in:
GJ committed 2026-10-21 17:04:02 +08:00
1 parent 81d6a85260
commit 48fce3975f
87 files changed
+5714 -1436

No files matched your search

@@ -6,10 +6,35 @@ import { projectsApi } from '@/features/projects/api'
import { subjectImagesApi } from '@/features/subject-images/api'
import { storyboardApi } from '@/features/storyboard/api'
afterEach(() => { vi.restoreAllMocks(); vi.unstubAllGlobals() })
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.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([])
@@ -20,10 +45,33 @@ describe('制作计划之前的正式分镜检查', () => {
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.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: [] })
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()