Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(desktop-app): use real handoff status producers (R17-L7)
Josuébdf730962eb7
diff --git a/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx b/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsxindex e9314a4bb..b4cc44af5 100644--- a/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx+++ b/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx@@ -71,7 +71,7 @@ describe('useAppController desktop environment handoff', () => {targetExternalRestApiBaseUrl: native.restB,}))- return { app, handle, handoff, targetOptionId: native.optionB.id }+ return { app, handle, handoff, native, targetOptionId: native.optionB.id }}it('keeps the signed-in session and skips selection when the user cancels', async () => {@@ -127,4 +127,24 @@ describe('useAppController desktop environment handoff', () => {'Could not load the selected desktop environment')})++ it('keeps the signed-in session and reports the native logout failure', async () => {+ const { app, handle, handoff, native } = await openSwitchConfirmation()+ const tokenStore = native.service as unknown as {+ tokenStore: { clearSessionToken: ReturnType<typeof vi.fn> }+ }+ tokenStore.tokenStore.clearSessionToken.mockRejectedValueOnce(+ new Error('secure storage unavailable')+ )++ await act(async () => app.result.current.handleConfirmDesktopEnvironmentSwitchConfirmation())+ await act(async () => handoff)++ expect(handle.logout).toHaveBeenCalledOnce()+ expect(handle.selectRuntimeConfigForHandoff).not.toHaveBeenCalled()+ expect(app.result.current.isAuthenticated).toBe(true)+ expect(app.result.current.statusText).toContain(+ "Logout failed: Error invoking remote method 'auth:logout': Error: secure storage unavailable"+ )+ })})diff --git a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.tsindex b0e88e7d9..c6a92f9b9 100644--- a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts+++ b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts@@ -479,56 +479,6 @@ describe('Desktop environment handoff concurrency', () => {)})- it('preserves a producer status when handoff logout returns no generation', async () => {- let publishProducerStatus:- | ((message: string, tone: 'info' | 'success' | 'error') => void)- | null = null- const logout = vi.fn(async () => {- publishProducerStatus?.('Logout failed: secure storage is unavailable.', 'error')- return null- })- const { handler, setStatus } = createHandler(- () => ({ booting: false, busy: false, authTransitioning: false, isAuthenticated: true }),- undefined,- logout- )- publishProducerStatus = setStatus-- await handler({- ...targetEnvironment,- externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,- })-- expect(logout).toHaveBeenCalledOnce()- expect(setStatus).toHaveBeenLastCalledWith(- 'Logout failed: secure storage is unavailable.',- 'error'- )- })-- it('preserves a producer status when environment selection returns null', async () => {- const { handler, selectRuntimeConfig, setStatus } = createHandler(() => ({- booting: false,- busy: false,- authTransitioning: false,- isAuthenticated: false,- }))- selectRuntimeConfig.mockImplementationOnce(async () => {- setStatus('Failed to switch environment: stale session.', 'info')- return null- })-- await handler({- ...targetEnvironment,- externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,- })-- expect(setStatus).toHaveBeenLastCalledWith(- 'Failed to switch environment: stale session.',- 'info'- )- })-it.each([{targetKind: 'saved target',