-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/IQSS/dataverse-frontend …
…into feature/244-integration-download-all-files
- Loading branch information
Showing
16 changed files
with
254 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 47 additions & 13 deletions
60
...tions/file-actions-cell/file-action-buttons/access-file-menu/FileDownloadOptions.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,64 @@ | ||
import { FileDownloadOptions } from '../../../../../../../../../../src/sections/dataset/dataset-files/files-table/file-actions/file-actions-cell/file-action-buttons/access-file-menu/FileDownloadOptions' | ||
import { FileMother } from '../../../../../../../../files/domain/models/FileMother' | ||
import { FileType } from '../../../../../../../../../../src/files/domain/models/File' | ||
import { FileUserPermissionsMother } from '../../../../../../../../files/domain/models/FileUserPermissionsMother' | ||
import { FilePermissionsProvider } from '../../../../../../../../../../src/sections/file/file-permissions/FilePermissionsProvider' | ||
import { FileRepository } from '../../../../../../../../../../src/files/domain/repositories/FileRepository' | ||
|
||
const fileNonTabular = FileMother.create({ | ||
tabularData: undefined, | ||
type: new FileType('text/plain') | ||
}) | ||
const fileTabular = FileMother.createWithTabularData() | ||
const fileNonTabular = FileMother.createNonTabular() | ||
const fileTabular = FileMother.createTabular() | ||
const fileRepository = {} as FileRepository | ||
describe('FileDownloadOptions', () => { | ||
beforeEach(() => { | ||
fileRepository.getUserPermissionsById = cy.stub().resolves( | ||
FileUserPermissionsMother.create({ | ||
canDownloadFile: true | ||
}) | ||
) | ||
}) | ||
|
||
it('renders the download options header', () => { | ||
cy.customMount(<FileDownloadOptions file={fileNonTabular} />) | ||
cy.customMount( | ||
<FilePermissionsProvider repository={fileRepository}> | ||
<FileDownloadOptions file={fileNonTabular} /> | ||
</FilePermissionsProvider> | ||
) | ||
|
||
cy.findByRole('heading', { name: 'Download Options' }).should('exist') | ||
}) | ||
|
||
it('does not render the download options if the user does not have permissions', () => { | ||
fileRepository.getUserPermissionsById = cy.stub().resolves( | ||
FileUserPermissionsMother.create({ | ||
canDownloadFile: false | ||
}) | ||
) | ||
|
||
cy.customMount( | ||
<FilePermissionsProvider repository={fileRepository}> | ||
<FileDownloadOptions file={fileNonTabular} /> | ||
</FilePermissionsProvider> | ||
) | ||
|
||
cy.findByRole('heading', { name: 'Download Options' }).should('not.exist') | ||
}) | ||
|
||
it('renders the download options for a non-tabular file', () => { | ||
cy.customMount(<FileDownloadOptions file={fileNonTabular} />) | ||
cy.customMount( | ||
<FilePermissionsProvider repository={fileRepository}> | ||
<FileDownloadOptions file={fileNonTabular} />{' '} | ||
</FilePermissionsProvider> | ||
) | ||
|
||
cy.findByRole('button', { name: 'Plain Text' }).should('exist') | ||
cy.findByRole('link', { name: 'Plain Text' }).should('exist') | ||
}) | ||
|
||
it('renders the download options for a tabular file', () => { | ||
cy.customMount(<FileDownloadOptions file={fileTabular} />) | ||
|
||
cy.findByRole('button', { name: 'Comma Separated Values (Original File Format)' }).should( | ||
'exist' | ||
cy.customMount( | ||
<FilePermissionsProvider repository={fileRepository}> | ||
<FileDownloadOptions file={fileTabular} /> | ||
</FilePermissionsProvider> | ||
) | ||
|
||
cy.findByRole('link', { name: 'Comma Separated Values (Original File Format)' }).should('exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.