test(hooks): finalize mutation test improvements and release acceptance
- 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
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// @ts-nocheck
|
||||
import { describe, it, expect, jest } from '@jest/globals';
|
||||
import { render } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// Mock sonner Toaster
|
||||
jest.mock('sonner', () => ({
|
||||
Toaster: ({ theme, className, ...props }: any) => (
|
||||
<div data-testid="sonner-toaster" data-theme={theme} className={className} {...props} />
|
||||
),
|
||||
toast: {
|
||||
success: jest.fn(),
|
||||
error: jest.fn(),
|
||||
info: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
// Mock lucide-react icons used by Toaster
|
||||
jest.mock('lucide-react', () => ({
|
||||
CheckCircle2: (props: any) => <svg data-testid="icon-check-circle" {...props} />,
|
||||
AlertCircle: (props: any) => <svg data-testid="icon-alert-circle" {...props} />,
|
||||
Info: (props: any) => <svg data-testid="icon-info" {...props} />,
|
||||
X: (props: any) => <svg data-testid="icon-x" {...props} />,
|
||||
}));
|
||||
|
||||
describe('Toaster', () => {
|
||||
it('renders with correct className "toaster group"', () => {
|
||||
const { Toaster } = require('./sonner');
|
||||
const { container } = render(<Toaster />);
|
||||
const toaster = container.querySelector('[data-testid="sonner-toaster"]');
|
||||
expect(toaster).toBeInTheDocument();
|
||||
expect(toaster).toHaveClass('toaster group');
|
||||
});
|
||||
|
||||
it('passes theme="light" to sonner', () => {
|
||||
const { Toaster } = require('./sonner');
|
||||
const { container } = render(<Toaster />);
|
||||
const toaster = container.querySelector('[data-testid="sonner-toaster"]');
|
||||
expect(toaster).toHaveAttribute('data-theme', 'light');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user