mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-21 06:26:26 +00:00
fix(client): work through the findings from the coverage pass
214 items came out of writing the tests. Real defects are corrected, dead code is removed rather than covered, and the tests that pinned the old behaviour move with them. Also drops two agent coverage scratch files that slipped into the coverage PR and adds the ignore rule that keeps them out.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// FE-W4UPQ-001 to FE-W4UPQ-010
|
||||
// FE-W4UPQ-001 to FE-W4UPQ-012
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
import { uploadFilesResilient, type UploadOpts, type UploadProgress } from './uploadQueue'
|
||||
|
||||
@@ -139,4 +139,20 @@ describe('uploadFilesResilient', () => {
|
||||
expect(uploadOne).not.toHaveBeenCalled()
|
||||
expect(res).toEqual({ succeeded: [], failed: [] })
|
||||
})
|
||||
|
||||
it('FE-W4UPQ-012: the bytes of an aborted attempt do not survive into the retry', async () => {
|
||||
const seen: UploadProgress[] = []
|
||||
let attempt = 0
|
||||
const uploadOne = async (f: File, opts: UploadOpts) => {
|
||||
attempt++
|
||||
opts.onUploadProgress({ loaded: f.size / 2, total: f.size } as never)
|
||||
if (attempt === 1) throw new Error('connection reset')
|
||||
return [f.name]
|
||||
}
|
||||
|
||||
await uploadFilesResilient([file('a.txt', 200)], uploadOne, { retries: 1, onProgress: p => { seen.push(p) } })
|
||||
|
||||
// 50% from the aborted attempt, then back to 0 before the retry reports its own.
|
||||
expect(seen.map(p => p.percent)).toEqual([50, 0, 50, 100])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user