feat(short-drama-agent-front): 优化分镜界面并新增弹窗手势
This commit is contained in:
1 parent
b15a6011ce
commit
d68f03471c
59 files changed
+2694
-857
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import KeyframeDialog from '@/features/production/components/KeyframeDialog.vue'
|
||||
import { billingCatalog, billingProfile, imageAuthorizationsFixture } from '../../fixtures/billing'
|
||||
|
||||
describe('首帧生成首屏只展示当前需要的信息', () => {
|
||||
it('普通有效授权不常驻未知费用提示;出现真实阻断后重新打开才展示人工许可', async () => {
|
||||
const list = imageAuthorizationsFixture(),
|
||||
generate = vi.fn<() => Promise<{ accepted: boolean }>>(async () => ({ accepted: true }))
|
||||
const fetcher = vi.fn<typeof fetch>(async url => {
|
||||
const path = String(url)
|
||||
if (path.endsWith('/generation-models')) return Response.json({ data: billingCatalog })
|
||||
if (path.endsWith('/creative-profile')) return Response.json({ data: billingProfile })
|
||||
if (path.endsWith('/resolve'))
|
||||
return Response.json({
|
||||
data: {
|
||||
provider: 'openai-image',
|
||||
model: 'gpt-image-2.5-flare',
|
||||
options: { size: '1024x1024', quality: 'auto', count: 1 }
|
||||
}
|
||||
})
|
||||
if (path.endsWith('/image-authorizations')) return Response.json({ data: list })
|
||||
throw new Error('未模拟:' + path)
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
const wrapper = mount(KeyframeDialog, {
|
||||
props: {
|
||||
projectId: 'clean-density-project',
|
||||
shotId: 'density-shot',
|
||||
shotTitle: '当前镜头',
|
||||
disabled: false,
|
||||
open: true,
|
||||
submitGeneration: generate
|
||||
},
|
||||
global: { stubs: { teleport: true } }
|
||||
})
|
||||
try {
|
||||
await flushPromises()
|
||||
expect(wrapper.find('[aria-label="本次人工追加许可"]').exists()).toBe(false)
|
||||
expect(wrapper.text()).not.toContain('原请求在途或费用待核对')
|
||||
expect(wrapper.text()).toContain('预览实际生成输入')
|
||||
list.billingBlocked = true
|
||||
await wrapper.setProps({ open: false })
|
||||
await flushPromises()
|
||||
await wrapper.setProps({ open: true })
|
||||
await flushPromises()
|
||||
expect(wrapper.find('[aria-label="本次人工追加许可"]').exists()).toBe(true)
|
||||
expect(wrapper.text()).toContain('有限许可不会核清旧费用')
|
||||
expect(generate).not.toHaveBeenCalled()
|
||||
expect(
|
||||
fetcher.mock.calls.some(([url]) => /\/keyframe$|\/generate|\/primary|\/vision/.test(String(url)))
|
||||
).toBe(false)
|
||||
} finally {
|
||||
wrapper.unmount()
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user