feat: restart to apply update, privileged helper, rollback

This commit is contained in:
fsylvain committed 2026-10-01 21:36:40 +02:00
1 parent 70460e4170
commit 54e8fd5fed
63 files changed
+8635 -164

No files matched your search

@@ -1,11 +1,15 @@
import { describe, expect, it } from 'vitest'
import {
AUTO_CHECK_INTERVAL_MS,
browserUpdatesDocsUrl,
displayVersion,
downloadAnnouncement,
formatDownloadProgress,
formatLastChecked,
formatReleased,
formatStartedAt,
formatStartedWithAge,
formatUpdatedAt,
isCheckDue,
} from '@/lib/updateFormat'
@@ -92,3 +96,42 @@ describe('downloadAnnouncement', () => {
expect(downloadAnnouncement('2.3.0-beta', percent)).toBe(expected)
})
})
describe('browserUpdatesDocsUrl', () => {
it('points the release url at the Browser updates section of the docs of the same repository', () => {
expect(
browserUpdatesDocsUrl('https://git.example/fsylvain/RenewCMS/releases/tag/v2.3.0-beta'),
).toBe(
'https://git.example/fsylvain/RenewCMS/src/branch/main/docs/deployment.md#browser-updates',
)
})
it('keeps a url it cannot interpret', () => {
expect(browserUpdatesDocsUrl('https://git.example/somewhere')).toBe(
'https://git.example/somewhere',
)
expect(browserUpdatesDocsUrl('not a url')).toBe('not a url')
})
})
describe('restart meta lines', () => {
const startedAt = '2026-09-30T09:51:00Z'
it('reads the start time', () => {
expect(formatStartedAt(startedAt)).toBe('Started at 09:51')
})
it('adds how long ago it was', () => {
expect(formatStartedWithAge(startedAt, new Date('2026-09-30T09:52:30Z'))).toBe(
'Started at 09:51 · 1 minute ago',
)
})
it.each([
['2026-09-30T09:52:00Z', 'Updated today at 09:52'],
['2026-09-29T18:12:00Z', 'Updated yesterday at 18:12'],
['2026-09-20T18:12:00Z', 'Updated 20 Sep 2026 at 18:12'],
])('reads the update time %s as %s', (iso, expected) => {
expect(formatUpdatedAt(iso, new Date('2026-09-30T10:00:00Z'))).toBe(expected)
})
})