fix: harden web ui self-update restart (#552)
This commit is contained in:
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user