Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/web/src/components/mcp/__tests__/ConnectedApps.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'
import { render, screen, cleanup, waitFor, fireEvent } from '@testing-library/react'

// One `t` for every render, like the real hook (useCallback). A fresh function per render
// re-fires the component's load effect on each render, and a late reload put a just-
// disconnected row back — the flake that failed two deploys (2026-10-01, 2026-10-04).
const { t } = vi.hoisted(() => ({ t: (k: string) => k }))
vi.mock('../../../hooks/useTranslation', () => ({
useTranslation: () => ({ t: (k: string) => k }),
useTranslation: () => ({ t }),
}))

const { auth, api } = vi.hoisted(() => ({
Expand Down Expand Up @@ -44,9 +48,9 @@ describe('ConnectedApps', () => {
render(<ConnectedApps />)
await screen.findByText('Claude')
fireEvent.click(screen.getAllByText('connect.apps.disconnect')[0])
// 3s, not the 1s default: on a loaded CI runner this took 1035ms and failed a deploy (2026-10-01).
await waitFor(() => expect(screen.queryByText('Claude')).toBeNull(), { timeout: 3000 })
await waitFor(() => expect(screen.queryByText('Claude')).toBeNull())
expect(api.revokeOAuthGrant).toHaveBeenCalledWith('g1')
expect(api.listOAuthGrants).toHaveBeenCalledTimes(1)
expect(screen.getByText('ChatGPT')).toBeTruthy()
})

Expand Down
Loading