Skip to content

The agent that grows with you

test(desktop): cover empty cloud agent status

tank321489c1ac298f8
diff --git a/apps/desktop/src/app/settings/gateway-settings.test.tsx b/apps/desktop/src/app/settings/gateway-settings.test.tsx
index 3cb519ca0a1..4872c1de0ba 100644
--- a/apps/desktop/src/app/settings/gateway-settings.test.tsx
+++ b/apps/desktop/src/app/settings/gateway-settings.test.tsx
@@ -632,7 +632,11 @@ describe('GatewaySettings', () => {
],
org: null
})
- getConnectionConfig.mockResolvedValue({ ...localConnection, mode: 'cloud', remoteUrl: 'https://portal.nousresearch.com' })
+ getConnectionConfig.mockResolvedValue({
+ ...localConnection,
+ mode: 'cloud',
+ remoteUrl: 'https://portal.nousresearch.com'
+ })
render(<GatewaySettings />)
@@ -640,6 +644,31 @@ describe('GatewaySettings', () => {
expect(screen.queryByText('Status: unknown')).toBeNull()
})
+ it('hides an empty cloud agent gateway status', async () => {
+ cloudDiscover.mockResolvedValue({
+ agents: [
+ {
+ dashboardGatewayState: '',
+ dashboardUrl: 'https://agent.example.com',
+ id: 'agent-1',
+ name: 'Cloud Agent',
+ status: 'active'
+ }
+ ],
+ org: null
+ })
+ getConnectionConfig.mockResolvedValue({
+ ...localConnection,
+ mode: 'cloud',
+ remoteUrl: 'https://portal.nousresearch.com'
+ })
+
+ render(<GatewaySettings />)
+
+ expect(await screen.findByText('Cloud Agent')).toBeTruthy()
+ expect(screen.queryByText(/^Status:/)).toBeNull()
+ })
+
it('shows a known cloud agent gateway status', async () => {
cloudDiscover.mockResolvedValue({
agents: [
@@ -653,11 +682,14 @@ describe('GatewaySettings', () => {
],
org: null
})
- getConnectionConfig.mockResolvedValue({ ...localConnection, mode: 'cloud', remoteUrl: 'https://portal.nousresearch.com' })
+ getConnectionConfig.mockResolvedValue({
+ ...localConnection,
+ mode: 'cloud',
+ remoteUrl: 'https://portal.nousresearch.com'
+ })
render(<GatewaySettings />)
expect(await screen.findByText('Status: active')).toBeTruthy()
})
- })
})
diff --git a/apps/desktop/src/app/settings/gateway-settings.tsx b/apps/desktop/src/app/settings/gateway-settings.tsx
index a09309e554d..b0ff8236638 100644
--- a/apps/desktop/src/app/settings/gateway-settings.tsx
+++ b/apps/desktop/src/app/settings/gateway-settings.tsx
@@ -1258,7 +1258,7 @@ function GatewayConnectionSettings({ embedded, standalone }: { embedded: boolean
<div className="grid gap-1">
{cloudAgents.map(agent => {
const connected = isConnectedAgent(agent)
- const gatewayState = agent.dashboardGatewayState.trim()
+ const gatewayState = (agent.dashboardGatewayState ?? '').trim()
const hasKnownGatewayState = gatewayState.length > 0 && gatewayState.toLowerCase() !== 'unknown'
return (