|
|
@@ -97,7 +97,10 @@ const harness = await vi.hoisted(async () => {
|
|
|
openExternal: vi.fn(),
|
|
|
applyRelease: vi.fn(() => { preparing.resolve(); return prepared.promise }),
|
|
|
mutateFailure: vi.fn<() => void>(),
|
|
|
- disableAllPlugins: vi.fn(async () => { pluginsEnabled = false }),
|
|
|
+ disableAllPlugins: vi.fn(async () => {
|
|
|
+ pluginsEnabled = false
|
|
|
+ return 'desktop-test-profile/cordis.patch.yml.bak-1789555200000'
|
|
|
+ }),
|
|
|
get preparing() { return preparing }, get prepared() { return prepared },
|
|
|
get hostStarted() { return hostStarted }, get navigated() { return navigated },
|
|
|
get dialogShown() { return dialogShown }, get quitCompleted() { return quitCompleted },
|
|
|
@@ -167,6 +170,7 @@ beforeEach(() => {
|
|
|
harness.reset()
|
|
|
harness.dialog.showMessageBox.mockImplementation(() => { harness.dialogShown.resolve(); return new Promise(() => {}) })
|
|
|
vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
|
+ vi.spyOn(console, 'info').mockImplementation(() => {})
|
|
|
vi.stubEnv('DSH_DESKTOP_PNPM_ENTRY', 'test-pnpm')
|
|
|
vi.stubEnv('DSH_DESKTOP_DSH_DIR', 'test-runtime')
|
|
|
vi.stubGlobal('process', { ...process, resourcesPath: 'desktop-test-resources' })
|
|
|
@@ -392,7 +396,7 @@ describe('desktop main startup', () => {
|
|
|
harness.prepared.reject(new Error('runtime resources missing'))
|
|
|
await harness.dialogShown.promise
|
|
|
expect(harness.dialog.showMessageBox.mock.calls[0]![0].detail).toContain('runtime resources missing')
|
|
|
- expect(harness.dialog.showMessageBox.mock.calls[0]![0].buttons).toEqual(['Exit', 'Restart', 'Disable third-party plugins, back up configuration, and restart'])
|
|
|
+ expect(harness.dialog.showMessageBox.mock.calls[0]![0].buttons).toEqual(['Exit', 'Restart', 'Disable third-party plugins, back up profile patch, and restart'])
|
|
|
expect(harness.windows[0]!.urls).toEqual(['dsh-app://app/'])
|
|
|
})
|
|
|
|
|
|
@@ -448,6 +452,13 @@ describe('desktop main startup', () => {
|
|
|
await harness.quitCompleted.promise
|
|
|
expect(harness.app.relaunch).toHaveBeenCalledTimes(response === 0 ? 0 : 1)
|
|
|
expect(harness.disableAllPlugins).toHaveBeenCalledTimes(response === 2 ? 1 : 0)
|
|
|
+ if (response === 2) {
|
|
|
+ expect(console.info).toHaveBeenCalledWith('Desktop profile recovery completed:', {
|
|
|
+ profilePatchBackup: 'desktop-test-profile/cordis.patch.yml.bak-1789555200000', homePatch: 'unchanged',
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ expect(console.info).not.toHaveBeenCalled()
|
|
|
+ }
|
|
|
expect(harness.dialog.showMessageBox).toHaveBeenCalledOnce()
|
|
|
expect(harness.windows[0]!.urls).toEqual(['dsh-app://app/'])
|
|
|
})
|