import { test, expect } from 'vitest'; import { render, screen } from '@testing-library/react'; import FileIcon from './FileIcon'; const ICON_NAME = 'Generic'; test('file icon renders correctly', () => { render( ); const icon = screen.getByRole('img', { hidden: true }); expect(icon).toHaveAttribute('role', 'img'); expect(icon).toHaveAttribute('aria-label', ''); expect(icon.tagName).toEqual('svg'); }); test('file icon with class name', () => { const CLASSNAME = 'foo'; render( ); const icon = screen.getByRole('img', {hidden: true}); expect(icon).toHaveClass('foo'); }); test('file icon with aria label', () => { const LABEL = 'My icon'; render( ); const icon = screen.getByRole('img', {hidden: true}); expect(icon).toHaveAttribute('aria-label', LABEL); expect(icon).not.toHaveAttribute('aria-hidden'); });