feat(short-drama-agent-front): 支持母版复用并优化生成交互
This commit is contained in:
1 parent
49fb9c7a27
commit
ee5e49957a
28 files changed
+634
-326
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { identityImageFixture } from '@/features/subject-identity/testing/fixtures'
|
||||
import { subjectIdentityApi } from '@/features/subject-identity/api'
|
||||
|
||||
/** 每个契约用例完成后清理网络替身。 */
|
||||
@@ -6,6 +7,22 @@ afterEach(() => vi.unstubAllGlobals())
|
||||
|
||||
/** 验证正式身份路由和付费请求没有自动重试。 */
|
||||
describe('身份正式接口契约', () => {
|
||||
it('普通生图保留任务编号和嵌套图片,选角仍使用独立图片回执', async () => {
|
||||
const image = identityImageFixture({ status: 'generating', imageUrl: null, isAnchor: false })
|
||||
const started = { executionId: 'execution-1', image }
|
||||
const fetcher = vi
|
||||
.fn<typeof fetch>()
|
||||
.mockResolvedValueOnce(new Response(JSON.stringify({ data: started }), { status: 202 }))
|
||||
.mockResolvedValueOnce(new Response(JSON.stringify({ data: image }), { status: 202 }))
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
const result = await subjectIdentityApi.generateImage('subject-1', { viewType: 'primary' })
|
||||
expect(result.executionId).toBe('execution-1')
|
||||
expect(result.image.identityId).toBe(image.identityId)
|
||||
expect(result.image.status).toBe('generating')
|
||||
expect(await subjectIdentityApi.generateCastingCandidate('subject-1', {})).toEqual(image)
|
||||
expect(fetcher).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('预览与实际生成传递相同参数,并支持取消预览', async () => {
|
||||
const fetcher = vi
|
||||
.fn<typeof fetch>()
|
||||
|
||||
Reference in new issue
Block a user