diff --git a/frontend/src/__tests__/mesh/gateCompatDecryptUx.test.tsx b/frontend/src/__tests__/mesh/gateCompatDecryptUx.test.tsx index 9bbcfe5..e282e14 100644 --- a/frontend/src/__tests__/mesh/gateCompatDecryptUx.test.tsx +++ b/frontend/src/__tests__/mesh/gateCompatDecryptUx.test.tsx @@ -539,15 +539,16 @@ describe('GateView compat-decrypt UX', () => { ); expect(await screen.findByText('sealed')).toBeInTheDocument(); - expect(mocks.subscribeGateSessionStreamEvents).toHaveBeenCalled(); - expect(mocks.fetchWormholeGateKeyStatus).toHaveBeenCalledWith( - 'infonet', - expect.objectContaining({ mode: 'session_stream' }), + await waitFor(() => expect(mocks.subscribeGateSessionStreamEvents).toHaveBeenCalled()); + await waitFor(() => + expect(mocks.fetchWormholeGateKeyStatus).toHaveBeenCalledWith( + 'infonet', + expect.objectContaining({ mode: 'session_stream' }), + ), ); expect(mocks.controlPlaneJson).not.toHaveBeenCalled(); waitSnapshotSpy.mockClear(); - await new Promise((resolve) => setTimeout(resolve, 0)); - expect(waitSnapshotSpy).not.toHaveBeenCalled(); + await waitFor(() => expect(waitSnapshotSpy).not.toHaveBeenCalled(), { timeout: 2000 }); streamEventListeners.forEach((listener) => listener({ @@ -560,12 +561,14 @@ describe('GateView compat-decrypt UX', () => { }), ); - await waitFor(() => - expect(fetchSnapshotSpy).toHaveBeenCalledWith( - 'infonet', - 40, - expect.objectContaining({ force: true, proofMode: 'session_stream' }), - ), + await waitFor( + () => + expect(fetchSnapshotSpy).toHaveBeenCalledWith( + 'infonet', + 40, + expect.objectContaining({ force: true, proofMode: 'session_stream' }), + ), + { timeout: 5000 }, ); expect( fetchMock.mock.calls.some(([input]) => diff --git a/frontend/src/__tests__/mesh/meshChatDecomposition.test.ts b/frontend/src/__tests__/mesh/meshChatDecomposition.test.ts index 6765c2a..754a530 100644 --- a/frontend/src/__tests__/mesh/meshChatDecomposition.test.ts +++ b/frontend/src/__tests__/mesh/meshChatDecomposition.test.ts @@ -221,9 +221,17 @@ describe('MeshChat decomposition — export stability', () => { expect(index).toMatch(/export\s+default\s+MeshChat/); }); - it('presentational shell exposes the gate resync affordance', () => { - const index = readFile('index.tsx'); - expect(index).toContain('RESYNC GATE STATE'); - expect(index).toContain('handleResyncGateState(selectedGate)'); + it('gate resync is controller-owned and exposed via Infonet / Mesh Terminal surfaces', () => { + const controller = readFile('useMeshChatController.ts'); + const panel = readFile('InfonetTerminalPanel.tsx'); + const terminal = fs.readFileSync( + path.resolve(MESH_CHAT_DIR, '../MeshTerminal.tsx'), + 'utf-8', + ); + expect(controller).toContain('handleResyncGateState'); + expect(controller).toContain('resyncWormholeGateState'); + expect(panel).toContain('InfonetShell'); + expect(terminal).toContain('gate resync'); + expect(terminal).toContain('resyncWormholeGateState'); }); });