import React from 'react';
import { render, screen } from '../../../test-utils/testing-library';
import FileIcon from '../FileIcon';

describe('icons/file-icon/FileIcon', () => {
    test.each([
        { name: 'FileAdobeExpress', ext: 'adobeexpress', label: 'ADOBEEXPRESS File' },
        { name: 'FileAudio', ext: 'aac', label: 'AAC File' },
        { name: 'FileAudio', ext: 'aif', label: 'AIF File' },
        { name: 'FileAudio', ext: 'aifc', label: 'AIFC File' },
        { name: 'FileAudio', ext: 'aiff', label: 'AIFF File' },
        { name: 'FileAudio', ext: 'amr', label: 'AMR File' },
        { name: 'FileAudio', ext: 'au', label: 'AU File' },
        { name: 'FileAudio', ext: 'flac', label: 'FLAC File' },
        { name: 'FileAudio', ext: 'm3u', label: 'M3U File' },
        { name: 'FileAudio', ext: 'm4a', label: 'M4A File' },
        { name: 'FileAudio', ext: 'mid', label: 'MID File' },
        { name: 'FileAudio', ext: 'mp3', label: 'MP3 File' },
        { name: 'FileAudio', ext: 'ra', label: 'RA File' },
        { name: 'FileAudio', ext: 'wav', label: 'WAV File' },
        { name: 'FileAudio', ext: 'wma', label: 'WMA File' },
        { name: 'FileAudio', ext: 'wpl', label: 'WPL File' },
        { name: 'FileCanvas', ext: 'boxcanvas', label: 'BOXCANVAS File' },
        { name: 'FileBoxNote', ext: 'boxnote', label: 'BOXNOTE File' },
        { name: 'FileCode', ext: 'as', label: 'AS File' },
        { name: 'FileCode', ext: 'as3', label: 'AS3 File' },
        { name: 'FileCode', ext: 'asm', label: 'ASM File' },
        { name: 'FileCode', ext: 'aspx', label: 'ASPX File' },
        { name: 'FileCode', ext: 'c', label: 'C File' },
        { name: 'FileCode', ext: 'cpp', label: 'CPP File' },
        { name: 'FileCode', ext: 'bat', label: 'BAT File' },
        { name: 'FileCode', ext: 'cc', label: 'CC File' },
        { name: 'FileCode', ext: 'cmake', label: 'CMAKE File' },
        { name: 'FileCode', ext: 'cs', label: 'CS File' },
        { name: 'FileCode', ext: 'css', label: 'CSS File' },
        { name: 'FileCode', ext: 'cxx', label: 'CXX File' },
        { name: 'FileCode', ext: 'db', label: 'DB File' },
        { name: 'FileCode', ext: 'diff', label: 'DIFF File' },
        { name: 'FileCode', ext: 'erb', label: 'ERB File' },
        { name: 'FileCode', ext: 'groovy', label: 'GROOVY File' },
        { name: 'FileCode', ext: 'h', label: 'H File' },
        { name: 'FileCode', ext: 'haml', label: 'HAML File' },
        { name: 'FileCode', ext: 'hh', label: 'HH File' },
        { name: 'FileCode', ext: 'htm', label: 'HTM File' },
        { name: 'FileCode', ext: 'html', label: 'HTML File' },
        { name: 'FileCode', ext: 'java', label: 'JAVA File' },
        { name: 'FileCode', ext: 'js', label: 'JS File' },
        { name: 'FileCode', ext: 'less', label: 'LESS File' },
        { name: 'FileCode', ext: 'm', label: 'M File' },
        { name: 'FileCode', ext: 'make', label: 'MAKE File' },
        { name: 'FileCode', ext: 'md', label: 'MD File' },
        { name: 'FileCode', ext: 'ml', label: 'ML File' },
        { name: 'FileCode', ext: 'mm', label: 'MM File' },
        { name: 'FileCode', ext: 'php', label: 'PHP File' },
        { name: 'FileCode', ext: 'pl', label: 'PL File' },
        { name: 'FileCode', ext: 'plist', label: 'PLIST File' },
        { name: 'FileCode', ext: 'properties', label: 'PROPERTIES File' },
        { name: 'FileCode', ext: 'py', label: 'PY File' },
        { name: 'FileCode', ext: 'rb', label: 'RB File' },
        { name: 'FileCode', ext: 'sass', label: 'SASS File' },
        { name: 'FileCode', ext: 'scala', label: 'SCALA File' },
        { name: 'FileCode', ext: 'script', label: 'SCRIPT File' },
        { name: 'FileCode', ext: 'scm', label: 'SCM File' },
        { name: 'FileCode', ext: 'sml', label: 'SML File' },
        { name: 'FileCode', ext: 'sql', label: 'SQL File' },
        { name: 'FileCode', ext: 'sh', label: 'SH File' },
        { name: 'FileCode', ext: 'wabba', label: 'WABBA File' },
        { name: 'FileCode', ext: 'yaml', label: 'YAML File' },
        { name: 'FileDocument', ext: 'dot', label: 'DOT File' },
        { name: 'FileDocument', ext: 'dotx', label: 'DOTX File' },
        { name: 'FileDocument', ext: 'msg', label: 'MSG File' },
        { name: 'FileDocument', ext: 'odt', label: 'ODT File' },
        { name: 'FileDocument', ext: 'rtf', label: 'RTF File' },
        { name: 'FileDocument', ext: 'wpd', label: 'WPD File' },
        { name: 'FileDocument', ext: 'xhtml', label: 'XHTML File' },
        { name: 'FileDocument', ext: 'xml', label: 'XML File' },
        { name: 'FileDocument', ext: 'xsd', label: 'XSD File' },
        { name: 'FileDocument', ext: 'xsl', label: 'XSL File' },
        { name: 'FileDwg', ext: 'dwg', label: 'DWG File' },
        { name: 'FileDwg', ext: 'dwgzip', label: 'DWGZIP File' },
        { name: 'FileExcel', ext: 'xls', label: 'XLS File' },
        { name: 'FileExcel', ext: 'xlsx', label: 'XLSX File' },
        { name: 'FileExcel', ext: 'xlsm', label: 'XLSM File' },
        { name: 'FileExcel', ext: 'xlsb', label: 'XLSB File' },
        { name: 'FileDocs', ext: 'gdoc', label: 'GDOC File' },
        { name: 'FileSheets', ext: 'gsheet', label: 'GSHEET File' },
        { name: 'FileSlides', ext: 'gslide', label: 'GSLIDE File' },
        { name: 'FileSlides', ext: 'gslides', label: 'GSLIDES File' },
        { name: 'FileVector', ext: 'eps', label: 'EPS File' },
        { name: 'FileIllustrator', ext: 'ai', label: 'AI File' },
        { name: 'FileIndesign', ext: 'idml', label: 'IDML File' },
        { name: 'FileIndesign', ext: 'indd', label: 'INDD File' },
        { name: 'FileIndesign', ext: 'indt', label: 'INDT File' },
        { name: 'FileIndesign', ext: 'inx', label: 'INX File' },
        { name: 'FileKeynote', ext: 'key', label: 'KEY File' },
        { name: 'FileNumbers', ext: 'numbers', label: 'NUMBERS File' },
        { name: 'FilePages', ext: 'pages', label: 'PAGES File' },
        { name: 'FileImage', ext: 'bmp', label: 'BMP File' },
        { name: 'FileImage', ext: 'gif', label: 'GIF File' },
        { name: 'FileImage', ext: 'gdraw', label: 'GDRAW File' },
        { name: 'FileImage', ext: 'jpeg', label: 'JPEG File' },
        { name: 'FileImage', ext: 'jpg', label: 'JPG File' },
        { name: 'FileImage', ext: 'png', label: 'PNG File' },
        { name: 'FileImage', ext: 'ps', label: 'PS File' },
        { name: 'FileImage', ext: 'svs', label: 'SVS File' },
        { name: 'FileImage', ext: 'svg', label: 'SVG File' },
        { name: 'FileImage', ext: 'tif', label: 'TIF File' },
        { name: 'FileImage', ext: 'tiff', label: 'TIFF File' },
        { name: 'FileImage', ext: 'heic', label: 'HEIC File' },
        { name: 'FileImage', ext: 'heif', label: 'HEIF File' },
        { name: 'FilePdf', ext: 'pdf', label: 'PDF File' },
        { name: 'FilePresentation', ext: 'odp', label: 'ODP File' },
        { name: 'FilePresentation', ext: 'otp', label: 'OTP File' },
        { name: 'FilePresentation', ext: 'pot', label: 'POT File' },
        { name: 'FilePresentation', ext: 'potx', label: 'POTX File' },
        { name: 'FilePowerpoint', ext: 'ppt', label: 'PPT File' },
        { name: 'FilePowerpoint', ext: 'pptx', label: 'PPTX File' },
        { name: 'FilePowerpoint', ext: 'pptm', label: 'PPTM File' },
        { name: 'FilePhotoshop', ext: 'psd', label: 'PSD File' },
        { name: 'FileSpreadsheet', ext: 'csv', label: 'CSV File' },
        { name: 'FileSpreadsheet', ext: 'ods', label: 'ODS File' },
        { name: 'FileSpreadsheet', ext: 'tsv', label: 'TSV File' },
        { name: 'FileSpreadsheet', ext: 'xlt', label: 'XLT File' },
        { name: 'FileSpreadsheet', ext: 'xltx', label: 'XLTX File' },
        { name: 'FileText', ext: 'txt', label: 'TXT File' },
        { name: 'FileText', ext: 'vi', label: 'VI File' },
        { name: 'FileText', ext: 'vim', label: 'VIM File' },
        { name: 'FileText', ext: 'webdoc', label: 'WEBDOC File' },
        { name: 'FileThreeD', ext: '3ds', label: '3DS File' },
        { name: 'FileThreeD', ext: 'dae', label: 'DAE File' },
        { name: 'FileThreeD', ext: 'fbx', label: 'FBX File' },
        { name: 'FileThreeD', ext: 'obj', label: 'OBJ File' },
        { name: 'FileThreeD', ext: 'ply', label: 'PLY File' },
        { name: 'FileThreeD', ext: 'stl', label: 'STL File' },
        { name: 'FileVideo', ext: '3g2', label: '3G2 File' },
        { name: 'FileVideo', ext: '3gp', label: '3GP File' },
        { name: 'FileVideo', ext: 'avi', label: 'AVI File' },
        { name: 'FileVideo', ext: 'flv', label: 'FLV File' },
        { name: 'FileVideo', ext: 'm2v', label: 'M2V File' },
        { name: 'FileVideo', ext: 'm2ts', label: 'M2TS File' },
        { name: 'FileVideo', ext: 'm4v', label: 'M4V File' },
        { name: 'FileVideo', ext: 'mkv', label: 'MKV File' },
        { name: 'FileVideo', ext: 'mov', label: 'MOV File' },
        { name: 'FileVideo', ext: 'mp4', label: 'MP4 File' },
        { name: 'FileVideo', ext: 'mpeg', label: 'MPEG File' },
        { name: 'FileVideo', ext: 'mpg', label: 'MPG File' },
        { name: 'FileVideo', ext: 'ogg', label: 'OGG File' },
        { name: 'FileVideo', ext: 'mts', label: 'MTS File' },
        { name: 'FileVideo', ext: 'qt', label: 'QT File' },
        { name: 'FileVideo', ext: 'wmv', label: 'WMV File' },
        { name: 'FileWord', ext: 'docx', label: 'DOCX File' },
        { name: 'FileWord', ext: 'doc', label: 'DOC File' },
        { name: 'FileWord', ext: 'docm', label: 'DOCM File' },
        { name: 'FileXbd', ext: 'xbd', label: 'XBD File' },
        { name: 'FileXdw', ext: 'xdw', label: 'XDW File' },
        { name: 'FileZip', ext: 'rar', label: 'RAR File' },
        { name: 'FileZip', ext: 'tgz', label: 'TGZ File' },
        { name: 'FileZip', ext: 'zip', label: 'ZIP File' },
    ])('should render the $name when $ext extension is provided', ({ ext, label }) => {
        render(<FileIcon extension={ext} />);
        expect(screen.getByLabelText(label)).toBeInTheDocument();
    });

    test('should render the default icon when no extension is provided', () => {
        render(<FileIcon title="title" />);
        expect(screen.getByLabelText('title')).toBeInTheDocument();
    });
});
