'use client'; import { render, screen } from '@testing-library/react'; import { describe, expect, it, vi } from 'vitest'; import { SwapSettingsSlippageDescription } from './SwapSettingsSlippageDescription'; vi.mock('../../styles/theme', async (importOriginal) => { const actual = await importOriginal(); return { ...actual, cn: (...args: string[]) => args.join(' '), // Keep the original 'text' export }; }); describe('SwapSettingsSlippageDescription', () => { it('renders children correctly', () => { render( Test Description , ); expect(screen.getByText('Test Description')).toBeInTheDocument(); }); it('applies default classes', () => { render( Test, ); const paragraph = screen.getByText('Test'); expect(paragraph.className).toContain( 'font-ock text-xs text-ock-foreground-muted mb-2', ); }); it('merges custom className with default classes', () => { render( Test , ); const paragraph = screen.getByText('Test'); expect(paragraph.className).toContain('custom-class'); expect(paragraph.className).toContain( 'font-ock text-xs text-ock-foreground-muted mb-2 custom-class', ); }); it('renders without children', () => { const { container } = render( Description , ); const paragraph = container.querySelector('p'); expect(paragraph).toBeInTheDocument(); expect(paragraph?.textContent).toBe('Description'); }); it('renders with complex children', () => { render( Complex Children , ); expect(screen.getByText('Complex')).toBeInTheDocument(); expect(screen.getByText('Children')).toBeInTheDocument(); }); });