feat: 同步最新生图与身份能力
This commit is contained in:
+26
-2
@@ -4,6 +4,8 @@ import { projectsApi } from '@/features/projects/api'
|
||||
import { breakdownApi } from '@/features/breakdown/api'
|
||||
import { storyboardApi } from '@/features/storyboard/api'
|
||||
import { subjectImagesApi } from '@/features/subject-images/api'
|
||||
import { subjectIdentityApi } from '@/features/subject-identity/api'
|
||||
import { productionApi } from '@/features/production/api'
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals()
|
||||
@@ -43,6 +45,29 @@ describe('后端 API 契约', () => {
|
||||
})
|
||||
expect(fetcher.mock.calls[4]![1]!.body).toBeUndefined()
|
||||
})
|
||||
it('新增预览、模块批处理和稳定母版接口使用正式数据库 ID', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async () => new Response('{"data":{}}'))
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
await subjectImagesApi.preview('form/id')
|
||||
await subjectImagesApi.generatePrompts('project/id', { concurrency: 2, force: false, module: 'scene' })
|
||||
await subjectImagesApi.generateProject('project/id', { concurrency: 1, force: false, module: 'prop' })
|
||||
await subjectIdentityApi.generateProject('project/id', { concurrency: 2, force: false, module: 'scene' })
|
||||
await subjectIdentityApi.generateStableAnchors('project/id', { module: 'prop', limit: 3, concurrency: 2 })
|
||||
await productionApi.previewKeyframe('shot/id')
|
||||
expect(fetcher.mock.calls.map(([url, init]) => [url, init?.method])).toEqual([
|
||||
['/api/subject-forms/form%2Fid/images/preview', 'POST'],
|
||||
['/api/projects/project%2Fid/subject-forms/generation-prompts', 'POST'],
|
||||
['/api/projects/project%2Fid/subject-images/generate', 'POST'],
|
||||
['/api/projects/project%2Fid/subject-identities/generate', 'POST'],
|
||||
['/api/projects/project%2Fid/subject-identities/anchors/generate', 'POST'],
|
||||
['/api/storyboard-shots/shot%2Fid/keyframe/preview', 'POST']
|
||||
])
|
||||
expect(JSON.parse(fetcher.mock.calls[4]![1]!.body as string)).toEqual({
|
||||
module: 'prop',
|
||||
limit: 3,
|
||||
concurrency: 2
|
||||
})
|
||||
})
|
||||
it('分镜只调用正式项目接口,并保持 force 和零次修复参数', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async () => new Response('{"data":{}}'))
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
@@ -110,12 +135,11 @@ describe('后端 API 契约', () => {
|
||||
)
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
expect(await projectsApi.list()).toEqual([{ id: 'p1' }])
|
||||
expect(await projectsApi.create({ title: '测试剧本', topic: '故事', style: '悬疑', episodeCount: 3 })).toEqual({
|
||||
expect(await projectsApi.create({ topic: '故事', style: '悬疑', episodeCount: 3 })).toEqual({
|
||||
projectId: 'p2',
|
||||
status: 'generating'
|
||||
})
|
||||
expect(JSON.parse(fetcher.mock.calls[1]![1].body as string)).toEqual({
|
||||
title: '测试剧本',
|
||||
topic: '故事',
|
||||
style: '悬疑',
|
||||
episodeCount: 3
|
||||
|
||||
Reference in New Issue
Block a user