@@ -49,45 +49,23 @@ function findToggleByLabel(container: Element, label: string) {
4949}
5050
5151describe ( "cron view list pane" , ( ) => {
52- it ( "uses agent-scoped summary values" , ( ) => {
52+ it . each ( [
53+ { name : "an enabled scheduler" , status : { enabled : true } , hasNextWake : true } ,
54+ { name : "a disabled scheduler" , status : { enabled : false } , hasNextWake : false } ,
55+ { name : "loading scheduler status" , status : null , hasNextWake : true } ,
56+ ] ) ( "uses agent-scoped summary values for $name" , ( { status, hasNextWake } ) => {
5357 const container = renderView ( {
5458 agentScoped : true ,
5559 scopedTotal : 3 ,
5660 scopedNextWakeAtMs : Date . now ( ) + 60_000 ,
57- status : { enabled : true , triggersEnabled : true , jobs : 99 , nextWakeAtMs : null } ,
61+ status : status ? { ... status , triggersEnabled : true , jobs : 99 , nextWakeAtMs : null } : null ,
5862 } ) ;
5963 const values = [ ...container . querySelectorAll ( ".cron-stat__value" ) ] . map ( ( entry ) =>
6064 entry . textContent ?. trim ( ) ,
6165 ) ;
6266
6367 expect ( values [ 0 ] ) . toBe ( "3" ) ;
64- expect ( values [ 2 ] ) . not . toBe ( "n/a" ) ;
65- } ) ;
66-
67- it ( "hides an agent-scoped next wake while the scheduler is disabled" , ( ) => {
68- const container = renderView ( {
69- agentScoped : true ,
70- scopedNextWakeAtMs : Date . now ( ) + 60_000 ,
71- status : { enabled : false , triggersEnabled : true , jobs : 3 , nextWakeAtMs : null } ,
72- } ) ;
73- const values = [ ...container . querySelectorAll ( ".cron-stat__value" ) ] . map ( ( entry ) =>
74- entry . textContent ?. trim ( ) ,
75- ) ;
76-
77- expect ( values [ 2 ] ) . toBe ( "n/a" ) ;
78- } ) ;
79-
80- it ( "keeps an agent-scoped next wake while scheduler status is loading" , ( ) => {
81- const container = renderView ( {
82- agentScoped : true ,
83- scopedNextWakeAtMs : Date . now ( ) + 60_000 ,
84- status : null ,
85- } ) ;
86- const values = [ ...container . querySelectorAll ( ".cron-stat__value" ) ] . map ( ( entry ) =>
87- entry . textContent ?. trim ( ) ,
88- ) ;
89-
90- expect ( values [ 2 ] ) . not . toBe ( "n/a" ) ;
68+ expect ( values [ 2 ] !== "n/a" ) . toBe ( hasNextWake ) ;
9169 } ) ;
9270
9371 it ( "wires the enabled tabs and marks the active one" , ( ) => {
0 commit comments