Files
Reims-Go/frontend/scripts/test-restore-images.mjs
T
千川白浪 e0ff794b0e feat: add experimental macOS desktop support on Apple Silicon (#207)
* feat: add experimental Apple Silicon support with Nivfold

Integrate the standalone Nivfold protocol 1 runner; tested against Nivfold f436fb6. The Windows Reims vGPU runtime remains independent.

* fix: open QQ invites and VM SSH on macOS

* fix: move VM, View and Help to the macOS menu bar

* feat(macos): add resumable Apple restore image downloads

Expose the compatible restore image in the VM wizard and Images page, validate downloads before caching, and fix macOS memory reporting and plugin SVG rendering.

* fix(macos): localize the native application menu

* fix(macos): address native desktop review findings
2026-12-06 00:47:07 +08:00

37 lines
2.3 KiB
JavaScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { loadTestModule } from './load-test-module.mjs'
const { cachedRestoreImage, matchesRestoreImage, restoreImageChoiceKey, restoreImageChoices, restoreImagePathMissing } = await loadTestModule(`export * from './lib/restoreImages'`)
const latest = { version: '26.6.2', build: '25G83', title: 'macOS Tahoe' }
const olderBuild = { kind: 'ipsw', version: latest.version, build: '25G82', title: 'macOS Tahoe', path: '/saved/old.ipsw' }
const partial = { ...olderBuild, build: latest.build, path: '/saved/new.ipsw.part', partial: true }
const otherKind = { ...olderBuild, build: latest.build, kind: 'offline' }
test('a previous IPSW build stays selectable without masking the latest one', () => {
const cache = [olderBuild, partial, otherKind]
assert.deepEqual(restoreImageChoices(latest, cache).map((choice) => choice.key), [
restoreImageChoiceKey(latest.version, latest.build), restoreImageChoiceKey(olderBuild.version, olderBuild.build),
])
assert.equal(cachedRestoreImage(cache, latest.version, latest.build), undefined)
assert.equal(cachedRestoreImage(cache, olderBuild.version, olderBuild.build), olderBuild)
assert.equal(matchesRestoreImage(olderBuild, latest.version, latest.build), false)
assert.equal(matchesRestoreImage(partial, latest.version, latest.build), true)
})
test('a downloaded latest build is not repeated and is used by its exact matching row', () => {
const complete = { ...partial, partial: false, path: '/saved/new.ipsw' }
const cache = [otherKind, olderBuild, partial, complete]
assert.equal(restoreImageChoices(latest, cache).length, 2)
assert.equal(cachedRestoreImage(cache, latest.version, latest.build), complete)
assert.equal(restoreImageChoices(undefined, [otherKind, olderBuild, partial]).length, 1)
})
test('a completed IPSW missing a cache path is distinct from an absent or partial download', () => {
const missing = { ...partial, partial: false, path: '' }
assert.equal(restoreImagePathMissing([missing], latest.version, latest.build), true)
assert.equal(restoreImagePathMissing([olderBuild, otherKind, { ...partial, path: '' }], latest.version, latest.build), false)
assert.equal(restoreImagePathMissing([missing], latest.version, olderBuild.build), false)
})