From 6d1c609c4cef957e416781877e77512094e103f8 Mon Sep 17 00:00:00 2001 From: Ellen Kraffmiller Date: Wed, 31 Jul 2024 19:32:31 -0400 Subject: [PATCH] add component test --- .../datasets-list/file-card/FileCard.spec.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/component/sections/collection/datasets-list/file-card/FileCard.spec.tsx diff --git a/tests/component/sections/collection/datasets-list/file-card/FileCard.spec.tsx b/tests/component/sections/collection/datasets-list/file-card/FileCard.spec.tsx new file mode 100644 index 000000000..d048fc5c0 --- /dev/null +++ b/tests/component/sections/collection/datasets-list/file-card/FileCard.spec.tsx @@ -0,0 +1,19 @@ +import { FileCard } from '../../../../../../src/sections/collection/datasets-list/file-card/FileCard' +import { FilePreviewMother } from '../../../../files/domain/models/FilePreviewMother' +import { DateHelper } from '../../../../../../src/shared/helpers/DateHelper' + +describe('FileCard', () => { + it('should render the card', () => { + const filePreview = FilePreviewMother.createTabular() + const persistentId = 'test-persistent-id' + cy.customMount() + + cy.contains(DateHelper.toDisplayFormat(filePreview.metadata.depositDate)).should('exist') + cy.contains(filePreview.metadata.type.toDisplayFormat()).should('exist') + cy.contains(filePreview.metadata.size.toString()).should('exist') + filePreview.metadata.description && + cy.findByText(filePreview.metadata.description).should('exist') + filePreview.datasetName && cy.findByText(filePreview.datasetName).should('exist') + cy.contains(DateHelper.toDisplayFormat(filePreview.metadata.depositDate)).should('exist') + }) +})