import { describe, it, expect, vi } from 'vitest' import { render, screen } from '@testing-library/react' vi.mock('next/navigation', () => ({ usePathname: () => '/hse/capa', useRouter: () => ({ push: vi.fn(), refresh: vi.fn() }), })) vi.mock('@/components/notifications/bell', () => ({ NotificationBell: () => null })) import { Sidebar } from '@/components/layout/sidebar' describe('Sidebar (Modernist shell)', () => { it('renders the role nav with Lucide icons instead of inline paths', () => { const { container } = render() expect(screen.getAllByText('Dashboard').length).toBeGreaterThan(0) expect(screen.getAllByText('CAPA').length).toBeGreaterThan(0) expect(container.querySelectorAll('svg.lucide').length).toBeGreaterThan(4) }) it('marks the active link in the accent with an aria-current', () => { render() const active = screen.getAllByRole('link', { name: /CAPA/ }).find(a => a.getAttribute('aria-current') === 'page') expect(active).toBeTruthy() expect(active?.className).toContain('text-accent-700') expect(active?.className).toContain('border-accent') }) it('is flat: a 2px divider rule, ground fill and no rounded corners except the avatar', () => { const { container } = render() const aside = container.querySelector('aside') expect(aside?.className).toContain('border-r') expect(aside?.className).toContain('bg-ground') const rounded = container.innerHTML.match(/rounded[\w-]*/g) ?? [] expect(rounded.every(r => r === 'rounded-full')).toBe(true) }) it('keeps the version label', () => { render() expect(screen.getByText('v1.2.2')).toBeTruthy() }) })