test(phase-5.1): 分片/教程接线的测试缝与棘轮台账随实现对齐
- upload.ts 保持 axios 实例 http.post(与打包产物一致),两处用例改对撞同一把缝 - 教程确认用例接受可选 file_key,并新增该参数的存在断言 - 静默 catch 台账登记 localStorage 两处,blocks 抬到 307 并逐支说明
This commit is contained in:
@@ -123,10 +123,11 @@ test('test_image_video_voice', async (t) => {
|
||||
test('test_image_video_upload_media', async (t) => {
|
||||
setupWindow()
|
||||
const calls: { url?: string; method?: string; data?: unknown }[] = []
|
||||
mockRequest(t, (config) => {
|
||||
calls.push(config)
|
||||
// upload.ts 走 axios 实例的 http.post(与 axios 响应体一起交由 bodyOf 解包),这里对撞同一把缝。
|
||||
t.mock.method(http, 'post', ((url: string, data?: unknown) => {
|
||||
calls.push({ url, method: 'POST', data })
|
||||
return okResponse({ url: 'https://oss/x', objectKey: 'k1', originalFilename: 'a.png', mediaType: 'image' })
|
||||
})
|
||||
}) as never)
|
||||
const file = new File(['x'], 'a.png', { type: 'image/png' })
|
||||
const result = await uploadImageVideoMedia(file)
|
||||
assert.equal(calls[0].url, '/newApi/api/files/upload')
|
||||
|
||||
Reference in New Issue
Block a user