Files
e-tib.com/components/search/AISearchResults.test.tsx
Marc Mintel 5977ebf23d
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 24s
Build & Deploy / 🧪 QA (push) Successful in 1m9s
Build & Deploy / 🏗️ Build (push) Successful in 2m49s
Build & Deploy / 🚀 Deploy (push) Successful in 26s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 45s
Build & Deploy / 🔔 Notify (push) Successful in 2s
fix(ci): fix getTranslations import and clean AISearchResults orphaned syntax
2026-05-28 11:48:21 +02:00

62 lines
1.7 KiB
TypeScript

import * as React from 'react';
import { describe, it, expect, vi } from 'vitest';
import { render } from '@testing-library/react';
import { AISearchResults } from './AISearchResults';
// Mock lucide-react
vi.mock('lucide-react', () => ({
ArrowUp: () => <div data-testid="arrow-up" />,
X: () => <div data-testid="close-icon" />,
Sparkles: () => <div data-testid="sparkles" />,
ChevronRight: () => <div data-testid="chevron-right" />,
RotateCcw: () => <div data-testid="rotate-ccw" />,
Copy: () => <div data-testid="copy" />,
Check: () => <div data-testid="check" />,
}));
// Mock next/link
vi.mock('next/link', () => ({
default: ({ children, href }: any) => <a href={href}>{children}</a>,
}));
// Mock useAnalytics
vi.mock('../analytics/useAnalytics', () => ({
useAnalytics: () => ({
trackEvent: vi.fn(),
}),
}));
// Mock react-markdown
vi.mock('react-markdown', () => ({
default: ({ children }: any) => <div>{children}</div>,
}));
// Mock remark-gfm
vi.mock('remark-gfm', () => ({
default: {},
}));
// Mock next-intl
vi.mock('next-intl', () => ({
useTranslations: () => {
const translate = (key: string) => key;
translate.raw = (key: string) => {
if (key === 'loadingTexts') return ['Lade...', 'Denke nach...'];
if (key === 'prompts') return ['Prompt 1', 'Prompt 2'];
return [];
};
return translate;
},
useLocale: () => 'en',
}));
describe('AISearchResults Component Test (TDD)', () => {
it('renders correctly when open', () => {
const handleClose = vi.fn();
const { container } = render(
<AISearchResults isOpen={true} onClose={handleClose} />
);
expect(container).toBeTruthy();
});
});