diff --git a/src/files/domain/models/File.ts b/src/files/domain/models/File.ts index 3ee029df4..d348f4df8 100644 --- a/src/files/domain/models/File.ts +++ b/src/files/domain/models/File.ts @@ -1,4 +1,6 @@ +import { DatasetVersion } from '../../../dataset/domain/models/Dataset' + export interface File { name: string - datasetTitle: string + datasetVersion: DatasetVersion } diff --git a/src/sections/file/File.tsx b/src/sections/file/File.tsx index 3fcb882b3..176eee903 100644 --- a/src/sections/file/File.tsx +++ b/src/sections/file/File.tsx @@ -34,7 +34,7 @@ export function File({ repository, id }: FileProps) {

{file.name}

- {t('subtext', { datasetTitle: file.datasetTitle })} + {t('subtext', { datasetTitle: file.datasetVersion.title })}
diff --git a/tests/component/files/domain/models/FileMother.ts b/tests/component/files/domain/models/FileMother.ts index f1b97fbd5..28b245c94 100644 --- a/tests/component/files/domain/models/FileMother.ts +++ b/tests/component/files/domain/models/FileMother.ts @@ -1,11 +1,12 @@ import { File } from '../../../../../src/files/domain/models/File' import { faker } from '@faker-js/faker' +import { DatasetVersionMother } from '../../../dataset/domain/models/DatasetMother' export class FileMother { static create(props?: Partial): File { return { name: faker.system.fileName(), - datasetTitle: faker.lorem.words(3), + datasetVersion: DatasetVersionMother.create(), ...props } } @@ -13,7 +14,7 @@ export class FileMother { static createRealistic(props?: Partial): File { return this.create({ name: 'file.csv', - datasetTitle: 'Dataset title', + datasetVersion: DatasetVersionMother.createRealistic(), ...props }) } diff --git a/tests/component/sections/file/File.spec.tsx b/tests/component/sections/file/File.spec.tsx index cfc07956e..1377c092a 100644 --- a/tests/component/sections/file/File.spec.tsx +++ b/tests/component/sections/file/File.spec.tsx @@ -14,7 +14,7 @@ describe('File', () => { cy.wrap(fileRepository.getById).should('be.calledWith', 19) cy.findAllByText(testFile.name).should('exist') - cy.findByText(`This file is part of "${testFile.datasetTitle}".`).should('exist') + cy.findByText(`This file is part of "${testFile.datasetVersion.title}".`).should('exist') }) it('renders skeleton while loading', () => {