fix(downloads): harden Add Window handoffs

This commit is contained in:
NimBold
2026-07-15 01:38:16 +03:30
parent 76850f2433
commit 19953a210e
4 changed files with 100 additions and 7 deletions
+25
View File
@@ -125,6 +125,31 @@ describe('add download metadata workflow', () => {
});
});
it('replaces a stale filename when a newer handoff supplies a new one', () => {
const existing = row({
file: 'old-name.zip',
requestContextVersion: 1,
generation: 2
});
const refreshed = reconcileDownloadRows(
existing.sourceUrl,
[existing],
undefined,
new Set(),
() => 'unused',
{ [existing.sourceUrl]: 'new-name.zip' },
{ [existing.sourceUrl]: 2 }
);
expect(refreshed[0]).toMatchObject({
file: 'new-name.zip',
status: 'loading',
generation: 3,
requestContextVersion: 2
});
});
it('appends every unseen handoff after the observed version', () => {
const merged = appendRequestUrlsAfterVersion(
'https://existing.example/file.zip',