Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(desktop-app): typecheck handoff wiring (R12-M7)

Josué24340a29ad14
diff --git a/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx b/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx
index deea08fd5..ded1cc9d6 100644
--- a/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx
+++ b/desktop-app/ui/src/hooks/__tests__/useAppController.desktopEnvironmentHandoff.test.tsx
@@ -81,7 +81,7 @@ describe('useAppController desktop environment handoff', () => {
targetExternalRestApiBaseUrl: 'https://target-api.example.test/api/v1',
})
)
- return { app, clerum, handle, handoff }
+ return { app, handle, handoff }
}
it('keeps the signed-in session and skips selection when the user cancels', async () => {
@@ -97,18 +97,18 @@ describe('useAppController desktop environment handoff', () => {
})
it('signs out before selecting the saved environment with the logout generation', async () => {
- const { app, clerum, handle, handoff } = await openSwitchConfirmation()
+ const { app, handle, handoff } = await openSwitchConfirmation()
await act(async () => app.result.current.handleConfirmDesktopEnvironmentSwitchConfirmation())
await act(async () => handoff)
expect(handle.logout).toHaveBeenCalledOnce()
expect(handle.selectRuntimeConfigForHandoff).toHaveBeenCalledWith('target-profile', 1)
- expect(handle.logout.mock.invocationCallOrder[0]).toBeLessThan(
- handle.selectRuntimeConfigForHandoff.mock.invocationCallOrder[0]
+ expect(handle.logout.mock.invocationCallOrder[0]!).toBeLessThan(
+ handle.selectRuntimeConfigForHandoff.mock.invocationCallOrder[0]!
)
expect(app.result.current.isAuthenticated).toBe(false)
- await expect(clerum.auth.getRuntimeConfigState()).resolves.toMatchObject({
+ await expect(handle.getRuntimeConfigState()).resolves.toMatchObject({
activeOptionId: 'target-profile',
})
})
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/__fixtures__/appControllerHarness.tsx b/desktop-app/ui/src/hooks/domain/__tests__/__fixtures__/appControllerHarness.tsx
index 27f378717..6eb669d80 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/__fixtures__/appControllerHarness.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/__fixtures__/appControllerHarness.tsx
@@ -121,6 +121,7 @@ export interface AppControllerClerumHandle {
passwordLogin: Fn
logout: Fn
getSessionGeneration: Fn
+ getRuntimeConfigState: () => Promise<DesktopRuntimeConfigState>
selectRuntimeConfigForHandoff: Fn
onDesktopEnvironmentSetup: Fn
emitDesktopEnvironmentSetup: (payload: {
@@ -192,6 +193,7 @@ export function extendMockClerumForAppController(
return createSessionState(true, sessionMe)
})
const getSessionGeneration = vi.fn(async () => sessionGeneration)
+ const getRuntimeConfigState = vi.fn(async () => runtimeConfigState)
const selectRuntimeConfigForHandoff = vi.fn(
async (optionId: string, expectedGeneration: number) => {
if (expectedGeneration !== sessionGeneration) throw new Error('stale_session_generation')
@@ -280,7 +282,7 @@ export function extendMockClerumForAppController(
auth: {
getDependenciesHealth,
getSessionState,
- getRuntimeConfigState: vi.fn(async () => runtimeConfigState),
+ getRuntimeConfigState,
getSessionGeneration,
selectRuntimeConfigForHandoff,
getDesktopReleaseStatus,
@@ -362,6 +364,7 @@ export function extendMockClerumForAppController(
passwordLogin,
logout,
getSessionGeneration,
+ getRuntimeConfigState,
selectRuntimeConfigForHandoff,
onDesktopEnvironmentSetup,
async emitDesktopEnvironmentSetup(payload) {