diff --git a/src/sections/dataset/dataset-files/files-table/file-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnailIcon.tsx b/src/sections/dataset/dataset-files/files-table/file-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnailIcon.tsx index c8111a425..7d406f9c9 100644 --- a/src/sections/dataset/dataset-files/files-table/file-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnailIcon.tsx +++ b/src/sections/dataset/dataset-files/files-table/file-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnailIcon.tsx @@ -1,9 +1,10 @@ import styles from './FileThumbnail.module.scss' import { FileType } from '../../../../../../../../files/domain/models/File' import { FileTypeToFileIconMap } from './FileTypeToFileIconMap' +import { IconName } from '@iqss/dataverse-design-system' export function FileThumbnailIcon({ type }: { type: FileType }) { - const icon = FileTypeToFileIconMap[type.value] || FileTypeToFileIconMap.default + const icon = FileTypeToFileIconMap[type.value] || IconName.OTHER return ( diff --git a/tests/component/sections/dataset/dataset-files/files-table/files-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnail.spec.tsx b/tests/component/sections/dataset/dataset-files/files-table/files-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnail.spec.tsx index 625700ea3..9689efb80 100644 --- a/tests/component/sections/dataset/dataset-files/files-table/files-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnail.spec.tsx +++ b/tests/component/sections/dataset/dataset-files/files-table/files-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnail.spec.tsx @@ -3,6 +3,7 @@ import { FileMother } from '../../../../../../../../files/domain/models/FileMoth import { FileRepository } from '../../../../../../../../../../src/files/domain/repositories/FileRepository' import { FileUserPermissionsMother } from '../../../../../../../../files/domain/models/FileUserPermissionsMother' import { FilePermissionsProvider } from '../../../../../../../../../../src/sections/file/file-permissions/FilePermissionsProvider' +import { FileType } from '../../../../../../../../../../src/files/domain/models/File' const fileRepository: FileRepository = {} as FileRepository describe('FileThumbnail', () => { @@ -68,7 +69,7 @@ describe('FileThumbnail', () => { cy.customMount() cy.findByAltText(file.name).should('not.exist') - cy.findByText('icon-file').should('exist') + cy.findByText('icon-other').should('exist') cy.findByText('Restricted File Icon').should('exist').parent().trigger('mouseover') cy.findByText('File Access: Restricted').should('exist') @@ -76,11 +77,11 @@ describe('FileThumbnail', () => { }) it('renders FileThumbnailIcon when thumbnail is not provided', () => { - const file = FileMother.createDefault() + const file = FileMother.createDefault({ type: new FileType('application/pdf') }) cy.customMount() - cy.findByText('icon-file').should('exist') + cy.findByText('icon-document').should('exist') cy.findByText('Restricted File Icon').should('not.exist') cy.findByText('Restricted with access Icon').should('not.exist') @@ -91,7 +92,7 @@ describe('FileThumbnail', () => { cy.customMount() - cy.findByText('icon-file').should('exist') + cy.findByText('icon-other').should('exist') cy.findByText('Restricted File Icon').should('exist') cy.findByText('Restricted File Icon').should('exist').parent().trigger('mouseover') @@ -114,7 +115,7 @@ describe('FileThumbnail', () => { ) - cy.findByText('icon-file').should('exist') + cy.findByText('icon-other').should('exist') cy.findByText('Restricted File Icon').should('not.exist') cy.findByText('Restricted with access Icon').should('exist').parent().trigger('mouseover')