Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(desktop-app): m1 re-apply swallow() for fire-and-forget probe calls
Diego Zacarias79895ef8265f
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsxindex dc95e8c43..95b5ffaa4 100644--- a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx+++ b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx@@ -8,6 +8,15 @@ import { desktopQueryDefaults } from '@lib/queryClient'import { desktopQueryKeys } from '../queryKeys'import { useGfsBrowserController } from '../useGfsBrowserController'+// Fire-and-forget UI actions in these probes mirror the production callers,+// which await the same promises inside try/catch (see FilesPage). Swallow+// rejections here so a late/rejected mutation — e.g. a createFolder that runs+// once `current` has cleared and throws "No folder selected" — never escapes as+// an unhandled rejection and fails an unrelated test later in the full suite.+const swallow = (promise: Promise<unknown>): void => {+ void promise.catch(() => {})+}+const userA = {id: 'user-a',email: '[email protected]',@@ -91,19 +100,17 @@ function Probe() {crumb {crumb.name}</button>))}- <button type="button" onClick={() => void ctrl.openUri('gfs://main/root')}>+ <button type="button" onClick={() => swallow(ctrl.openUri('gfs://main/root'))}>open</button>- <button type="button" onClick={() => void ctrl.refreshAffordances()}>+ <button type="button" onClick={() => swallow(ctrl.refreshAffordances())}>refresh permissions</button><buttontype="button"onClick={() =>ctrl.current- ? void ctrl- .createFile(ctrl.current.resourceId, 'notes.md', 'IyBOb3Rlcw==')- .catch(() => {})+ ? swallow(ctrl.createFile(ctrl.current.resourceId, 'notes.md', 'IyBOb3Rlcw==')): undefined}>@@ -113,9 +120,13 @@ function Probe() {type="button"onClick={() =>ctrl.current- ? void ctrl- .renameResource(ctrl.current.resourceId, 'Renamed report.md', ctrl.current.version)- .catch(() => {})+ ? swallow(+ ctrl.renameResource(+ ctrl.current.resourceId,+ 'Renamed report.md',+ ctrl.current.version+ )+ ): undefined}>@@ -125,9 +136,7 @@ function Probe() {type="button"onClick={() =>ctrl.current- ? void ctrl- .replaceFile(ctrl.current.resourceId, 'aGVsbG8=', ctrl.current.version)- .catch(() => {})+ ? swallow(ctrl.replaceFile(ctrl.current.resourceId, 'aGVsbG8=', ctrl.current.version)): undefined}>@@ -137,13 +146,13 @@ function Probe() {type="button"onClick={() =>ctrl.current- ? void ctrl- .replaceFileFromPath(+ ? swallow(+ ctrl.replaceFileFromPath(ctrl.current.resourceId,'/tmp/replacement.bin',ctrl.current.version)- .catch(() => {})+ ): undefined}>@@ -153,9 +162,9 @@ function Probe() {type="button"onClick={() =>ctrl.current- ? void ctrl- .moveResource(ctrl.current.resourceId, 'destination-1', ctrl.current.version)- .catch(() => {})+ ? swallow(+ ctrl.moveResource(ctrl.current.resourceId, 'destination-1', ctrl.current.version)+ ): undefined}>@@ -1189,7 +1198,7 @@ function ManageProbe() {<div data-testid="current">{ctrl.current?.resourceId ?? 'none'}</div><div data-testid="grants-count">{ctrl.grants.length}</div><div data-testid="shares-count">{ctrl.shares.length}</div>- <button type="button" onClick={() => void ctrl.openUri('gfs://main/root')}>+ <button type="button" onClick={() => swallow(ctrl.openUri('gfs://main/root'))}>open root</button><button type="button" onClick={() => setManageOpen(true)}>@@ -1198,27 +1207,27 @@ function ManageProbe() {<button type="button" onClick={() => setManageOpen(false)}>close manage</button>- <button type="button" onClick={() => void ctrl.refreshGrants()}>+ <button type="button" onClick={() => swallow(ctrl.refreshGrants())}>refresh grants</button>- <button type="button" onClick={() => void ctrl.revokeGrant('grant-42')}>+ <button type="button" onClick={() => swallow(ctrl.revokeGrant('grant-42'))}>revoke grant</button>- <button type="button" onClick={() => void ctrl.grant(['user:bob'], ['read'], true)}>+ <button type="button" onClick={() => swallow(ctrl.grant(['user:bob'], ['read'], true))}>grant inherit true</button>- <button type="button" onClick={() => void ctrl.grant(['team:qa'], ['read'], false)}>+ <button type="button" onClick={() => swallow(ctrl.grant(['team:qa'], ['read'], false))}>grant inherit false</button>- <button type="button" onClick={() => void ctrl.refreshShares()}>+ <button type="button" onClick={() => swallow(ctrl.refreshShares())}>refresh shares</button>- <button type="button" onClick={() => void ctrl.revokeShare('share-42')}>+ <button type="button" onClick={() => swallow(ctrl.revokeShare('share-42'))}>revoke share</button><buttontype="button"- onClick={() => void ctrl.createShare(['user:bob']).then(() => ctrl.refreshShares())}+ onClick={() => swallow(ctrl.createShare(['user:bob']).then(() => ctrl.refreshShares()))}>create share</button>