feat: update button (download, verify, stage)

This commit is contained in:
fsylvain committed 2026-10-01 18:13:45 +02:00
1 parent 834493a4f5
commit 70460e4170
41 files changed
+5345 -97

No files matched your search

@@ -2,6 +2,8 @@ import { describe, expect, it } from 'vitest'
import {
AUTO_CHECK_INTERVAL_MS,
displayVersion,
downloadAnnouncement,
formatDownloadProgress,
formatLastChecked,
formatReleased,
isCheckDue,
@@ -64,3 +66,29 @@ describe('formatReleased', () => {
expect(formatReleased('2026-09-24T08:00:00Z')).toBe('Released 24 Sep 2026')
})
})
describe('formatDownloadProgress', () => {
it('reads the board sample as 42% and 11 of 26 MB', () => {
expect(
formatDownloadProgress({
percent: 42,
downloaded_bytes: 11534336,
total_bytes: 27262976,
}),
).toBe('42% · 11 of 26 MB')
})
})
describe('downloadAnnouncement', () => {
it.each([
[0, 'Downloading version 2.3.0-beta'],
[24, 'Downloading version 2.3.0-beta'],
[25, 'Downloading version 2.3.0-beta, 25 percent'],
[49, 'Downloading version 2.3.0-beta, 25 percent'],
[50, 'Downloading version 2.3.0-beta, 50 percent'],
[75, 'Downloading version 2.3.0-beta, 75 percent'],
[100, 'Downloading version 2.3.0-beta, 75 percent'],
])('reads %i percent as %s', (percent, expected) => {
expect(downloadAnnouncement('2.3.0-beta', percent)).toBe(expected)
})
})