Skip to content

Commit 9edcfda

Browse files
committed
exercise dropdown under "Edit Dataset" button #821
1 parent e41580f commit 9edcfda

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

tests/component/dataset/domain/models/DatasetMother.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ export class DatasetMother {
341341
const dataset = {
342342
id: faker.datatype.number(),
343343
persistentId: faker.datatype.uuid(),
344+
datasetType: 'dataset',
344345
version: DatasetVersionMother.create(),
345346
internalVersionNumber: faker.datatype.number(),
346347
license: {
@@ -450,7 +451,8 @@ export class DatasetMother {
450451
dataset.nextMajorVersion,
451452
dataset.nextMinorVersion,
452453
dataset.requiresMajorVersionUpdate,
453-
dataset.fileStore
454+
dataset.fileStore,
455+
dataset.datasetType
454456
).build()
455457
}
456458

tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,33 @@ describe('DatasetActionButtons', () => {
7373
cy.findByRole('button', { name: 'Share' }).should('exist')
7474
})
7575

76+
it.only('renders the DatasetActionButtons with the Edit Dataset button and dropdown', () => {
77+
const dataset = DatasetMother.create({
78+
version: DatasetVersionMother.createDraftAsLatestVersionWithSomeVersionHasBeenReleased(),
79+
permissions: DatasetPermissionsMother.create({
80+
canDownloadFiles: true,
81+
canUpdateDataset: true,
82+
canPublishDataset: false
83+
}),
84+
fileDownloadSizes: [
85+
DatasetFileDownloadSizeMother.createOriginal({ value: 2000, unit: FileSizeUnit.BYTES })
86+
]
87+
})
88+
89+
cy.mountAuthenticated(
90+
<DatasetActionButtons
91+
dataset={dataset}
92+
datasetRepository={datasetRepository}
93+
collectionRepository={collectionRepository}
94+
contactRepository={contactRepository}
95+
/>
96+
)
97+
98+
cy.findByRole('group', { name: 'Dataset Action Buttons' }).should('exist')
99+
cy.findByRole('button', { name: 'Edit Dataset' }).click()
100+
cy.findByRole('button', { name: 'Metadata' }).click()
101+
})
102+
76103
it('should not render Share button if the the dataset is deaccessioned and user has no edit permission', () => {
77104
const dataset = DatasetMother.createDeaccessionedwithNoEditPermission()
78105
cy.mountAuthenticated(

0 commit comments

Comments
 (0)