Skip to content

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

TypeScript

test(desktop-app): l2 assert exact setVisible calls in deep-link overlay phase

Diego Zacarias03534adc0058
diff --git a/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx b/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx
index 565ac8659..f424cadcf 100644
--- a/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/SandboxUiPage.test.tsx
@@ -879,15 +879,17 @@ describe('SandboxUiPage', () => {
// embedded app and the user can never reach the confirm/dismiss buttons.
rerender(<SandboxUiPage deepLinkShellOverlayOpen />)
- await waitFor(() => {
- expect(screen.getByTestId('sandbox-ui-embed-preview')).toBeTruthy()
- expect(sandboxUi.setVisible).toHaveBeenLastCalledWith(false)
- })
+ // toHaveBeenLastCalledWith(false) would be satisfied by a stray false->true
+ // ->false flicker inside this phase; assert the exact call list (scoped by
+ // the mockClear above) so any transient setVisible(true) fails the test.
+ await waitFor(() => expect(screen.getByTestId('sandbox-ui-embed-preview')).toBeTruthy())
+ expect(sandboxUi.setVisible.mock.calls).toEqual([[false]])
sandboxUi.setVisible.mockClear()
rerender(<SandboxUiPage />)
- await waitFor(() => expect(sandboxUi.setVisible).toHaveBeenLastCalledWith(true))
+ await waitFor(() => expect(screen.queryByTestId('sandbox-ui-embed-preview')).toBeNull())
+ expect(sandboxUi.setVisible.mock.calls).toEqual([[true]])
})
it('hides an active native view even before local launch state is available', async () => {