import { renderHook } from '@testing-library/react-hooks'; import { useShowUploadDownloadIcon } from '../use-show-upload-download-icon'; describe('useShowUploadDownloadIcon', () => { it('should return false when showDownload is not provided', () => { const { result } = renderHook(() => useShowUploadDownloadIcon({ file: { status: 'idle', key: 'file1' } }), ); expect(result.current).toBe(false); }); it('should return false when file is uploading', () => { const { result } = renderHook(() => useShowUploadDownloadIcon({ file: { status: 'uploading', key: 'file2' }, showDownload: true, }), ); expect(result.current).toBe(false); }); it('should return the result of showDownload function when it is provided', () => { const { result } = renderHook(() => useShowUploadDownloadIcon({ file: { status: 'done', key: 'file3' }, showDownload: () => true, }), ); expect(result.current).toBe(true); }); it('should return true when file has downloadUrl', () => { const { result } = renderHook(() => useShowUploadDownloadIcon({ file: { status: 'done', downloadUrl: 'url', key: 'file4' }, showDownload: true, }), ); expect(result.current).toBe(true); }); it('should return true when file has url', () => { const { result } = renderHook(() => useShowUploadDownloadIcon({ file: { status: 'done', url: 'url', key: 'file5' }, showDownload: true, }), ); expect(result.current).toBe(true); }); it('should return true when onDownload is provided', () => { const { result } = renderHook(() => useShowUploadDownloadIcon({ file: { status: 'done', key: 'file6' }, onDownload: () => {}, showDownload: true, }), ); expect(result.current).toBe(true); }); });