Files
Reims-Go/frontend/scripts/test-guest-drivers.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

46 lines
2.5 KiB
JavaScript

import assert from 'node:assert/strict'
import test from 'node:test'
import { loadTestModule } from './load-test-module.mjs'
const { defaultGuestDriver, eligibleGuestDrivers, hasRestoreImagePicker, needsRuntimeSetup, restoreImageField } = await loadTestModule(`export * from './lib/guestDrivers'`)
const mac = { os: 'darwin', arch: 'arm64' }
const win = { os: 'windows', arch: 'amd64' }
const restore = { type: 'string', 'x-filePattern': '*.ipsw' }
const create_schema = { properties: { restore_path: restore } }
const native = { id: 'example.native', runtime_kind: 'external', builtin: true, create_schema }
const thirdParty = { id: 'example.additional', runtime_kind: 'external', create_schema }
const legacy = { id: 'builtin.driver.reims-macos', runtime_kind: 'reims-vgpu', builtin: true }
test('Apple Silicon skips portable runtime setup, but Windows still offers it when missing', () => {
assert.equal(needsRuntimeSetup(mac, false), false)
assert.equal(needsRuntimeSetup(win, false), true)
assert.equal(needsRuntimeSetup(win, true), false)
assert.equal(needsRuntimeSetup({ os: 'darwin', arch: 'amd64' }, false), true)
})
test('a host-provided external driver can create without a portable runtime', () => {
const eligible = eligibleGuestDrivers([legacy, native, thirdParty], false)
assert.deepEqual(eligible, [native, thirdParty])
assert.equal(defaultGuestDriver(eligible, mac), native)
assert.equal(defaultGuestDriver([thirdParty, native], mac), thirdParty)
assert.equal(defaultGuestDriver(eligible, mac, 'offline'), undefined)
assert.equal(defaultGuestDriver([thirdParty, legacy], win), legacy)
assert.equal(defaultGuestDriver([thirdParty, legacy], win, 'online'), legacy)
assert.deepEqual(eligibleGuestDrivers([legacy, native], true), [legacy, native])
})
test('cached IPSW routes only to the trusted native restore driver', () => {
assert.equal(defaultGuestDriver([thirdParty, legacy, native], mac, 'ipsw'), native)
assert.equal(defaultGuestDriver([thirdParty, legacy], mac, 'ipsw'), undefined)
assert.equal(defaultGuestDriver([legacy, native], win, 'ipsw'), undefined)
assert.equal(restoreImageField(native, mac), 'restore_path')
})
test('only a host-trusted create schema can add the IPSW picker', () => {
assert.equal(hasRestoreImagePicker(native, restore), true)
assert.equal(hasRestoreImagePicker(thirdParty, restore), false)
assert.equal(hasRestoreImagePicker(native, { ...restore, 'x-filePattern': '*.ipsw;*' }), false)
assert.equal(hasRestoreImagePicker(native, { ...restore, type: 'integer' }), false)
})