feature: 增加功能 导出详细报告

This commit is contained in:
baozaotumao2025
2026-07-19 00:29:06 +08:00
parent 789d4fc4e9
commit 12d8293250
12 changed files with 92 additions and 15 deletions
+8
View File
@@ -17,6 +17,14 @@ describe('ApiClient', () => {
).rejects.toMatchObject({ kind: 'validation' })
})
it('returns file responses without parsing them as JSON', async () => {
const blob = new Blob(['# report'], { type: 'text/markdown' })
const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue(new Response(blob))
await expect(new ApiClient('/api', () => 'token').request('/runs/1/export', { responseType: 'blob' })).resolves.toEqual(expect.any(Blob))
expect(new Headers(fetchMock.mock.calls[0][1]?.headers).get('Accept')).toBe('text/markdown')
})
it('refreshes and replays a business request once after 401', async () => {
let token = 'old-token'
const refresh = vi.fn(async (force?: boolean) => {