55 DatasetVersionMother
66} from '../../../dataset/domain/models/DatasetMother'
77import { DatasetLockReason } from '../../../../../src/dataset/domain/models/Dataset'
8+ import { SettingRepository } from '../../../../../src/settings/domain/repositories/SettingRepository'
9+ import { SettingMother } from '../../../settings/domain/models/SettingMother'
10+ import { SettingsProvider } from '../../../../../src/sections/settings/SettingsProvider'
811
912describe ( 'PublishDatasetMenu' , ( ) => {
1013 it ( 'renders the PublishDatasetMenu if is dataset latest version and it is a draft and publishing is allowed' , ( ) => {
@@ -16,7 +19,35 @@ describe('PublishDatasetMenu', () => {
1619
1720 cy . customMount ( < PublishDatasetMenu dataset = { dataset } /> )
1821
19- cy . findByRole ( 'button' , { name : 'Publish Dataset' } ) . should ( 'exist' ) . should ( 'be.enabled' )
22+ cy . findByRole ( 'button' , { name : 'Publish Dataset' } )
23+ . should ( 'exist' )
24+ . should ( 'be.enabled' )
25+ . click ( )
26+
27+ cy . findByRole ( 'button' , { name : 'Publish' } ) . should ( 'exist' )
28+ } )
29+
30+ it ( 'renders the PublishDatasetMenu with the Change Curation Status sub menu' , ( ) => {
31+ const dataset = DatasetMother . create ( {
32+ version : DatasetVersionMother . createDraftAsLatestVersion ( ) ,
33+ permissions : DatasetPermissionsMother . createWithPublishingDatasetAllowed ( ) ,
34+ locks : [ ]
35+ } )
36+
37+ const settingRepository = { } as SettingRepository
38+ settingRepository . getByName = cy
39+ . stub ( )
40+ . resolves ( SettingMother . createExternalStatusesAllowed ( [ 'Author Contacted' , 'Privacy Review' ] ) )
41+
42+ cy . customMount (
43+ < SettingsProvider repository = { settingRepository } >
44+ < PublishDatasetMenu dataset = { dataset } />
45+ </ SettingsProvider >
46+ )
47+
48+ cy . findByRole ( 'button' , { name : 'Publish Dataset' } ) . click ( )
49+
50+ cy . findByRole ( 'button' , { name : 'Change Curation Status' } ) . should ( 'exist' )
2051 } )
2152
2253 it ( 'does not render the PublishDatasetMenu if publishing is not allowed' , ( ) => {
0 commit comments