Skip to content

Commit

Permalink
feat(FilesCountInfo): pass FileSearchCriteria to js-dataverse use case
Browse files Browse the repository at this point in the history
  • Loading branch information
MellyGray committed Oct 10, 2023
1 parent 3ea6545 commit a3bb0ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/files/infrastructure/FileJSDataverseRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ export class FileJSDataverseRepository implements FileRepository {
datasetVersion: DatasetVersion,
criteria: FileCriteria
): Promise<FilesCountInfo> {
// 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)
})
Expand Down
7 changes: 3 additions & 4 deletions tests/e2e-integration/e2e/sections/dataset/Dataset.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
Expand Down

0 comments on commit a3bb0ba

Please sign in to comment.