From d5609ac02f1e71330ebccff5ee001cc9660a7027 Mon Sep 17 00:00:00 2001 From: Shadowbroker <43977454+BigBodyCobain@users.noreply.github.com> Date: Sun, 24 May 2026 21:55:54 -0600 Subject: [PATCH] test(infonet): cover gate directory renderer (landing + command variants) (#327) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the focused test Codex wrote alongside the gate-directory UI work that already shipped in #326 (the `renderGateDirectory` helper used both under the Infonet logo on the landing screen and as the output of the `gates` command in the terminal). The renderer itself is already on origin/main; this PR just ships the test so CI catches regressions to the dual-variant render. Verified locally: - frontend npm run test:ci -- src/__tests__/mesh/infonetShellGateDirectory.test.tsx → 1/1 pass Co-authored-by: Claude Opus 4.7 --- .../mesh/infonetShellGateDirectory.test.tsx | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 frontend/src/__tests__/mesh/infonetShellGateDirectory.test.tsx diff --git a/frontend/src/__tests__/mesh/infonetShellGateDirectory.test.tsx b/frontend/src/__tests__/mesh/infonetShellGateDirectory.test.tsx new file mode 100644 index 0000000..5067f89 --- /dev/null +++ b/frontend/src/__tests__/mesh/infonetShellGateDirectory.test.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import { act, cleanup, render, screen } from '@testing-library/react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; + +vi.mock('@/mesh/meshIdentity', () => ({ + getNodeIdentity: vi.fn(() => ({ publicKey: 'test-public-key', nodeId: '!sb_test' })), + getWormholeIdentityDescriptor: vi.fn(() => ({ publicKey: 'wormhole-public-key' })), +})); + +vi.mock('@/mesh/wormholeIdentityClient', () => ({ + activateWormholeGatePersona: vi.fn(), + createWormholeGatePersona: vi.fn(), + enterWormholeGate: vi.fn(), + fetchWormholeIdentity: vi.fn(), + listWormholeGatePersonas: vi.fn(async () => ({ personas: [] })), +})); + +vi.mock('@/components/InfonetTerminal/GateView', () => ({ default: () =>
Gate view
})); +vi.mock('@/components/InfonetTerminal/MarketView', () => ({ default: () =>
Market view
})); +vi.mock('@/components/InfonetTerminal/ProfileView', () => ({ default: () =>
Profile view
})); +vi.mock('@/components/InfonetTerminal/MessagesView', () => ({ default: () =>
Messages view
})); +vi.mock('@/components/InfonetTerminal/TerminalDashboard', () => ({ default: () =>
Dashboard
})); +vi.mock('@/components/InfonetTerminal/WeatherWidget', () => ({ default: () =>
Weather
})); +vi.mock('@/components/InfonetTerminal/TrendingPosts', () => ({ default: () =>
Trending
})); +vi.mock('@/components/InfonetTerminal/HashchainEvents', () => ({ default: () =>
Hashchain
})); +vi.mock('@/components/InfonetTerminal/NetworkStats', () => ({ default: () =>
Network stats
})); +vi.mock('@/components/InfonetTerminal/AIQueryView', () => ({ default: () =>
AI view
})); +vi.mock('@/components/InfonetTerminal/PetitionsView', () => ({ default: () =>
Petitions
})); +vi.mock('@/components/InfonetTerminal/UpgradeView', () => ({ default: () =>
Upgrades
})); +vi.mock('@/components/InfonetTerminal/ResolutionView', () => ({ default: () =>
Resolution
})); +vi.mock('@/components/InfonetTerminal/GateShutdownView', () => ({ default: () =>
Gate shutdown
})); +vi.mock('@/components/InfonetTerminal/BootstrapView', () => ({ default: () =>
Bootstrap
})); +vi.mock('@/components/InfonetTerminal/FunctionKeyView', () => ({ default: () =>
Function keys
})); + +describe('InfonetShell gate directory', () => { + beforeEach(() => { + vi.useFakeTimers(); + }); + + afterEach(() => { + vi.useRealTimers(); + cleanup(); + }); + + it('renders available gates under the landing logo section', async () => { + const { default: InfonetShell } = await import('@/components/InfonetTerminal/InfonetShell'); + + render( {}} />); + await act(async () => { + vi.advanceTimersByTime(2500); + }); + + expect(screen.getByText('AVAILABLE OBFUSCATED GATES:')).toBeTruthy(); + expect(screen.getByRole('button', { name: /\[>\]\s*infonet/i })).toBeTruthy(); + expect(screen.getByRole('button', { name: /\[>\]\s*gathered-intel/i })).toBeTruthy(); + }); +});