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(); + }); +});