mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
Give raw-material uploads a dedicated five-minute timeout and process file-picker and drag/drop uploads through a shared two-worker queue, so constrained uplinks no longer abort multipart requests at the global 30-second deadline. Switch wiki processing jobs and page citations to application-assigned IDs: the PostgreSQL/Kingbase migrations define plain BIGINT primary keys without identity defaults, so database-generated keys fail on insert.
24 lines
718 B
TypeScript
24 lines
718 B
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import { http, wikiApi } from '@/api'
|
|
|
|
describe('wikiApi.uploadRaw', () => {
|
|
afterEach(() => {
|
|
vi.restoreAllMocks()
|
|
})
|
|
|
|
it('uses the dedicated five-minute upload timeout instead of the global request timeout', async () => {
|
|
const post = vi.spyOn(http, 'post').mockResolvedValue({ data: { id: 'raw-1' } })
|
|
const formData = new FormData()
|
|
formData.append('file', new File(['fixture'], 'fixture.txt', { type: 'text/plain' }))
|
|
|
|
await wikiApi.uploadRaw(42, formData)
|
|
|
|
expect(post).toHaveBeenCalledWith(
|
|
'/wiki/knowledge-bases/42/raw/upload',
|
|
formData,
|
|
expect.objectContaining({ timeout: 300_000 }),
|
|
)
|
|
})
|
|
})
|