@@ -40,6 +40,10 @@ jest.mock('../../config/domain-page-tabs.config', () => ({
4040 title : 'Workflows' ,
4141 artwork : ( ) => < div data-testid = "workflows-artwork" /> ,
4242 } ,
43+ 'cron-list' : {
44+ title : 'Cron' ,
45+ artwork : ( ) => < div data-testid = "cron-list-artwork" /> ,
46+ } ,
4347 metadata : {
4448 title : 'Metadata' ,
4549 artwork : ( ) => < div data-testid = "metadata-artwork" /> ,
@@ -67,28 +71,34 @@ describe(DomainPageTabs.name, () => {
6771 jest . clearAllMocks ( ) ;
6872 } ) ;
6973
70- it ( 'renders tabs titles correctly with failover history disabled ' , async ( ) => {
71- await setup ( { enableFailoverHistory : false } ) ;
74+ it ( 'renders tabs titles correctly' , async ( ) => {
75+ await setup ( ) ;
7276
7377 expect ( screen . getByText ( 'Workflows' ) ) . toBeInTheDocument ( ) ;
7478 expect ( screen . getByText ( 'Metadata' ) ) . toBeInTheDocument ( ) ;
7579 expect ( screen . getByText ( 'Settings' ) ) . toBeInTheDocument ( ) ;
7680 expect ( screen . getByText ( 'Archival' ) ) . toBeInTheDocument ( ) ;
81+
82+ expect ( screen . queryByText ( 'Cron' ) ) . toBeNull ( ) ;
7783 expect ( screen . queryByText ( 'Failovers' ) ) . toBeNull ( ) ;
7884 } ) ;
7985
80- it ( 'renders tabs with failover history enabled' , async ( ) => {
81- await setup ( { enableFailoverHistory : true } ) ;
86+ it ( 'renders tabs with cron and failover history enabled' , async ( ) => {
87+ await setup ( {
88+ enableFailoverHistory : true ,
89+ enableCronList : true ,
90+ } ) ;
8291
8392 expect ( screen . getByText ( 'Workflows' ) ) . toBeInTheDocument ( ) ;
93+ expect ( screen . getByText ( 'Cron' ) ) . toBeInTheDocument ( ) ;
8494 expect ( screen . getByText ( 'Metadata' ) ) . toBeInTheDocument ( ) ;
8595 expect ( screen . getByText ( 'Failovers' ) ) . toBeInTheDocument ( ) ;
8696 expect ( screen . getByText ( 'Settings' ) ) . toBeInTheDocument ( ) ;
8797 expect ( screen . getByText ( 'Archival' ) ) . toBeInTheDocument ( ) ;
8898 } ) ;
8999
90100 it ( 'reroutes when new tab is clicked' , async ( ) => {
91- const { user } = await setup ( { enableFailoverHistory : false } ) ;
101+ const { user } = await setup ( ) ;
92102
93103 const metadataTab = await screen . findByText ( 'Metadata' ) ;
94104 await user . click ( metadataTab ) ;
@@ -108,7 +118,7 @@ describe(DomainPageTabs.name, () => {
108118 writable : true ,
109119 } ) ;
110120
111- const { user } = await setup ( { enableFailoverHistory : false } ) ;
121+ const { user } = await setup ( ) ;
112122
113123 const metadataTab = await screen . findByText ( 'Metadata' ) ;
114124 await user . click ( metadataTab ) ;
@@ -121,7 +131,7 @@ describe(DomainPageTabs.name, () => {
121131 } ) ;
122132
123133 it ( 'renders tabs artworks correctly' , async ( ) => {
124- await setup ( { enableFailoverHistory : false } ) ;
134+ await setup ( ) ;
125135
126136 expect ( screen . getByTestId ( 'workflows-artwork' ) ) . toBeInTheDocument ( ) ;
127137 expect ( screen . getByTestId ( 'metadata-artwork' ) ) . toBeInTheDocument ( ) ;
@@ -152,13 +162,12 @@ describe(DomainPageTabs.name, () => {
152162 } ) ;
153163} ) ;
154164
155- async function setup ( {
156- error,
157- enableFailoverHistory,
158- } : {
165+ async function setup ( opts ?: {
159166 error ?: boolean ;
160167 enableFailoverHistory ?: boolean ;
168+ enableCronList ?: boolean ;
161169} ) {
170+ const { error, enableFailoverHistory, enableCronList } = opts ?? { } ;
162171 const user = userEvent . setup ( ) ;
163172
164173 render (
@@ -183,8 +192,10 @@ async function setup({
183192 ) ;
184193 } else {
185194 return HttpResponse . json (
186- ( enableFailoverHistory ??
187- false ) satisfies GetConfigResponse < 'FAILOVER_HISTORY_ENABLED' >
195+ ( ( enableFailoverHistory ??
196+ false ) satisfies GetConfigResponse < 'FAILOVER_HISTORY_ENABLED' > ) ||
197+ ( ( enableCronList ??
198+ false ) satisfies GetConfigResponse < 'CRON_LIST_ENABLED' > )
188199 ) ;
189200 }
190201 } ,
0 commit comments