The merge landed main's `minimize-to-tray` and `hud-modifier-types` modules next to ours, leaving two `perfectionist/sort-imports` errors — the only blocking failures in the `JS & TS checks` job (`apps/desktop :: check:lint`): electron/main.ts:321 ./minimize-to-tray before ./native-auth-decisions src/global.d.ts:6 ../electron/hud-modifier-types before ../electron/machine-profile Resolved with the workspace's own `npm run fix` (eslint --fix + prettier), which also pads the `padding-line-between-statements` warnings it can. Lint is 0 errors after.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { expect, test } from 'vitest'
|
|
|
|
import { bootstrapSnapshot } from './bootstrap-state'
|
|
import { type InstallStamp } from './install-stamp'
|
|
|
|
function stamp(payload: InstallStamp['payload']): InstallStamp {
|
|
return {
|
|
schemaVersion: 2,
|
|
commit: null,
|
|
commitDate: null,
|
|
branch: null,
|
|
builtAt: null,
|
|
dirty: false,
|
|
source: 'build',
|
|
distribution: 'desktop-app',
|
|
updateMechanism: 'self',
|
|
baseVersion: null,
|
|
displayVersion: null,
|
|
distance: null,
|
|
payload,
|
|
tag: null
|
|
}
|
|
}
|
|
|
|
test.each(['bundled', 'bootstrap', 'light'] as const)(
|
|
'bootstrap state retains the %s artifact fact across failure and reset',
|
|
payload => {
|
|
const artifact = stamp(payload)
|
|
const state = { error: 'backend exited before setup', setupChoice: null }
|
|
expect(bootstrapSnapshot(state, artifact)).toEqual({ ...state, bundled: payload === 'bundled' })
|
|
expect(bootstrapSnapshot({ error: null, setupChoice: null }, artifact).bundled).toBe(payload === 'bundled')
|
|
expect(state).not.toHaveProperty('bundled')
|
|
expect(bootstrapSnapshot(state, null).bundled).toBe(false)
|
|
expect(bootstrapSnapshot({ ...state, bundled: payload !== 'bundled' }, artifact).bundled).toBe(
|
|
payload === 'bundled'
|
|
)
|
|
}
|
|
)
|