mateclaw/mateclaw-ui/src/api/__tests__/wikiUpload.test.ts
matevip cd0360ff3f fix(wiki): stabilize concurrent raw-material uploads and PostgreSQL-compatible IDs
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.
2026-07-15 14:27:14 +08:00

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 }),
)
})
})