fix(short-drama-agent-front): 修复资产库请求与管理流程

This commit is contained in:
GJ committed 2026-11-01 22:17:59 +08:00
1 parent 41d1cfe3ed
commit f8b0fbb8ca
10 files changed
+672 -77

No files matched your search

+14 -1
View File
@@ -17,6 +17,16 @@ afterEach(() => {
})
describe('后端 API 契约', () => {
it.each([502, 503, 504])('网关%s的空响应和HTML响应保留状态并提供连接恢复说明', async status => {
vi.stubGlobal(
'fetch',
vi
.fn<typeof fetch>()
.mockImplementation(async () => new Response('<html>gateway unavailable</html>', { status }))
)
await expect(request('/assets')).rejects.toMatchObject({ status, message: expect.stringContaining('连接') })
})
it('图库读取与单图、批量和切换主图使用各自接口,模型由后端统一配置', async () => {
const fetcher = vi.fn<typeof fetch>().mockImplementation(async () => new Response('{"data":[]}'))
vi.stubGlobal('fetch', fetcher)
@@ -169,7 +179,10 @@ describe('后端 API 契约', () => {
.mockResolvedValueOnce(new Response('<html>Bad Gateway</html>', { status: 502 }))
)
await expect(request('/projects')).rejects.toMatchObject({ status: 400, details: ['缺少形态'] })
await expect(request('/projects')).rejects.toThrow('服务暂时无法返回有效结果')
await expect(request('/projects')).rejects.toMatchObject({
status: 502,
message: expect.stringContaining('连接')
})
})
it('预览模块使用逗号参数,三种恢复不误发到 start', async () => {