- Raise use-swipe-gesture mutation score to 66.13% (target 65%+) - Maintain use-reduced-motion mutation score at 76.32% (target 50%+) - Fix use-reduced-motion.ts ESLint set-state-in-effect warning - Add UJ-10 deep searcher journey (category browse → article read → content discovery) - Add 40 new test files (analytics, detail, sections, ui, lib components) - Update test-strategy-plan.md to v2.0 (sync test count to 1591) - Sync README.md with final release metrics Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
62 lines
2.3 KiB
TypeScript
62 lines
2.3 KiB
TypeScript
// @ts-nocheck
|
|
import { describe, it, expect } from '@jest/globals';
|
|
import { render, screen } from '@testing-library/react';
|
|
import '@testing-library/jest-dom';
|
|
import { Alert, AlertTitle, AlertDescription } from './alert';
|
|
|
|
describe('Alert', () => {
|
|
it('renders default variant', () => {
|
|
render(<Alert>Default alert</Alert>);
|
|
const alert = screen.getByRole('alert');
|
|
expect(alert).toBeInTheDocument();
|
|
expect(alert).toHaveTextContent('Default alert');
|
|
});
|
|
|
|
it('renders destructive variant', () => {
|
|
render(<Alert variant="destructive">Destructive alert</Alert>);
|
|
const alert = screen.getByRole('alert');
|
|
expect(alert).toBeInTheDocument();
|
|
expect(alert).toHaveTextContent('Destructive alert');
|
|
});
|
|
|
|
it('renders success variant', () => {
|
|
render(<Alert variant="success">Success alert</Alert>);
|
|
const alert = screen.getByRole('alert');
|
|
expect(alert).toBeInTheDocument();
|
|
expect(alert).toHaveTextContent('Success alert');
|
|
});
|
|
|
|
it('renders warning variant', () => {
|
|
render(<Alert variant="warning">Warning alert</Alert>);
|
|
const alert = screen.getByRole('alert');
|
|
expect(alert).toBeInTheDocument();
|
|
expect(alert).toHaveTextContent('Warning alert');
|
|
});
|
|
|
|
it('renders info variant', () => {
|
|
render(<Alert variant="info">Info alert</Alert>);
|
|
const alert = screen.getByRole('alert');
|
|
expect(alert).toBeInTheDocument();
|
|
expect(alert).toHaveTextContent('Info alert');
|
|
});
|
|
|
|
it('renders AlertTitle with data-slot', () => {
|
|
const { container } = render(<AlertTitle>Title text</AlertTitle>);
|
|
const title = container.querySelector('[data-slot="alert-title"]');
|
|
expect(title).toBeInTheDocument();
|
|
expect(title).toHaveTextContent('Title text');
|
|
});
|
|
|
|
it('renders AlertDescription with data-slot', () => {
|
|
const { container } = render(<AlertDescription>Description text</AlertDescription>);
|
|
const desc = container.querySelector('[data-slot="alert-description"]');
|
|
expect(desc).toBeInTheDocument();
|
|
expect(desc).toHaveTextContent('Description text');
|
|
});
|
|
|
|
it('applies custom className', () => {
|
|
const { container } = render(<Alert className="custom-class">Alert</Alert>);
|
|
const alert = container.querySelector('[data-slot="alert"]');
|
|
expect(alert).toHaveClass('custom-class');
|
|
});
|
|
}); |