feat(downloads): add live limits clipboard capture and byte progress

This commit is contained in:
NimBold
2026-07-15 20:35:05 +03:30
parent 9917f29743
commit 1d197432b2
18 changed files with 536 additions and 25 deletions
+23
View File
@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest';
import { formatDownloadBytes, resolveDownloadSizeDisplay } from './downloadProgress';
describe('download progress size display', () => {
it('formats byte counts using the binary units used by the download engines', () => {
expect(formatDownloadBytes(0)).toBe('0 B');
expect(formatDownloadBytes(1.2 * 1024 ** 3)).toBe('1.20 GB');
});
it('keeps estimated totals distinguishable from exact totals', () => {
expect(resolveDownloadSizeDisplay({
downloadedBytes: 1.2 * 1024 ** 3,
totalBytes: 2.4 * 1024 ** 3,
totalIsEstimate: true,
fallbackSize: 'Unknown'
})).toEqual({
downloaded: '1.20 GB',
total: '2.40 GB',
totalIsEstimate: true,
fallback: 'Unknown'
});
});
});