diff --git a/ui/tests/unit/components/profiles/openrouter-quick-start.test.tsx b/ui/tests/unit/components/profiles/openrouter-quick-start.test.tsx new file mode 100644 index 00000000..2fdd1394 --- /dev/null +++ b/ui/tests/unit/components/profiles/openrouter-quick-start.test.tsx @@ -0,0 +1,40 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; +import i18n from '@/lib/i18n'; +import { OpenRouterQuickStart } from '@/components/profiles/openrouter-quick-start'; +import { render, screen } from '@tests/setup/test-utils'; + +vi.mock('@/hooks/use-openrouter-models', () => ({ + useOpenRouterReady: () => ({ + modelCount: 318, + isLoading: false, + }), +})); + +describe('OpenRouterQuickStart', () => { + const props = { + onOpenRouterClick: vi.fn(), + onAlibabaCodingPlanClick: vi.fn(), + onCliproxyClick: vi.fn(), + onCustomClick: vi.fn(), + }; + + beforeEach(async () => { + await i18n.changeLanguage('en'); + }); + + it('prompts the user to select an existing API profile instead of showing the empty-state copy', () => { + render(); + + expect(screen.getByRole('heading', { name: 'Select an API profile' })).toBeInTheDocument(); + expect(screen.getByText('1 profile')).toBeInTheDocument(); + expect(screen.getByText(/You already have 1 profile in this workspace\./)).toBeInTheDocument(); + expect(screen.queryByText('No API profiles yet')).not.toBeInTheDocument(); + }); + + it('keeps the original empty-state title when no API profiles exist', () => { + render(); + + expect(screen.getByRole('heading', { name: 'No API profiles yet' })).toBeInTheDocument(); + expect(screen.getAllByText('Recommended')).not.toHaveLength(0); + }); +});