From a3bb0bad88624cc0ea239baad48657a8c11ac850 Mon Sep 17 00:00:00 2001 From: MellyGray Date: Tue, 10 Oct 2023 17:52:54 +0200 Subject: [PATCH] feat(FilesCountInfo): pass FileSearchCriteria to js-dataverse use case --- src/files/infrastructure/FileJSDataverseRepository.ts | 8 ++++++-- .../e2e-integration/e2e/sections/dataset/Dataset.spec.tsx | 7 +++---- .../integration/files/FileJSDataverseRepository.spec.ts | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/files/infrastructure/FileJSDataverseRepository.ts b/src/files/infrastructure/FileJSDataverseRepository.ts index cec70dea0..c2bfae269 100644 --- a/src/files/infrastructure/FileJSDataverseRepository.ts +++ b/src/files/infrastructure/FileJSDataverseRepository.ts @@ -73,9 +73,13 @@ export class FileJSDataverseRepository implements FileRepository { datasetVersion: DatasetVersion, criteria: FileCriteria ): Promise { - // TODO - Take into account the FileCriteria https://github.com/IQSS/dataverse-frontend/issues/172 return getDatasetFileCounts - .execute(datasetPersistentId, datasetVersion.toString(), includeDeaccessioned) + .execute( + datasetPersistentId, + datasetVersion.toString(), + includeDeaccessioned, + DomainFileMapper.toJSFileSearchCriteria(criteria) + ) .then((jsFilesCountInfo) => { return JSFileMapper.toFilesCountInfo(jsFilesCountInfo) }) diff --git a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx index 30d80621a..4973b2165 100644 --- a/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx +++ b/tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx @@ -300,8 +300,7 @@ describe('Dataset', () => { }) }) - it.skip('applies filters to the Files Table in the correct order', () => { - // TODO - Restore this test once fileCountsInfo use case takes into account the filtered results https://github.com/IQSS/dataverse-frontend/issues/172 + it('applies filters to the Files Table in the correct order', () => { const files = [ FileHelper.create('csv', { description: 'Some description', @@ -362,7 +361,7 @@ describe('Dataset', () => { cy.findByText('blob-4').should('exist') cy.findByText('blob-5').should('exist') - cy.findByRole('button', { name: 'Filter Tag: All' }).click({ force: true }) + cy.findByRole('button', { name: 'File Tags: All' }).click({ force: true }) cy.findByText('Category (4)').should('exist').click({ force: true }) cy.findByText('1 to 4 of 4 Files').should('exist') @@ -384,7 +383,7 @@ describe('Dataset', () => { cy.findByText('blob-4').should('exist') cy.findByText('blob-5').should('exist') - cy.findByRole('button', { name: 'Filter Type: All' }).click({ force: true }) + cy.findByRole('button', { name: 'File Type: All' }).click({ force: true }) cy.findByText('Text/csv (2)').should('exist').click({ force: true }) cy.findByText('1 to 2 of 2 Files').should('exist') diff --git a/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts b/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts index d0019758d..9a0614e91 100644 --- a/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts +++ b/tests/e2e-integration/integration/files/FileJSDataverseRepository.spec.ts @@ -588,11 +588,11 @@ describe('File JSDataverse Repository', () => { perFileTag: [ { tag: new FileTag('category_1'), - count: 2 + count: 1 }, { tag: new FileTag('category'), - count: 1 + count: 2 } ] }