fix: harden web ui self-update restart (#552)

This commit is contained in:
Zhicheng Han
2026-05-10 14:18:52 +02:00
committed by GitHub
parent 96c9338f6a
commit 0d14afe9b4
4 changed files with 148 additions and 36 deletions
+13
View File
@@ -33,4 +33,17 @@ describe('App Store', () => {
expect(store.sidebarCollapsed).toBe(false)
expect(window.localStorage.getItem('hermes_sidebar_collapsed')).toBe('0')
})
it('clears the updating state and reports failure when self-update request fails', async () => {
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {})
mockSystemApi.triggerUpdate.mockRejectedValue(new Error('install failed'))
const store = useAppStore()
const ok = await store.doUpdate()
expect(ok).toBe(false)
expect(store.updating).toBe(false)
expect(consoleError).toHaveBeenCalledWith('Failed to update Hermes Web UI:', expect.any(Error))
consoleError.mockRestore()
})
})