@@ -105,7 +105,7 @@ describe('DetailsHealth', () => {
105105 } ) ;
106106
107107 describe ( 'SSE reactive updates' , ( ) => {
108- it ( 'should call fetchCachedHealthGroups once on mount, not on SSE version changes' , async ( ) => {
108+ it ( 'should re-fetch cached health groups on SSE version changes' , async ( ) => {
109109 const baseApp = applications [ 0 ] ;
110110 const instance1 = new Application ( baseApp ) . instances [ 0 ] ;
111111 instance1 . fetchCachedHealthGroups = vi
@@ -119,7 +119,8 @@ describe('DetailsHealth', () => {
119119 await screen . findAllByRole ( 'status' ) ;
120120 expect ( instance1 . fetchCachedHealthGroups ) . toHaveBeenCalledTimes ( 1 ) ;
121121
122- // Same instance, different version (SSE update) — should NOT call fetchCachedHealthGroups again
122+ // Same instance, different version (SSE update) — should re-fetch the
123+ // (server-cached) group list so it self-corrects when groups change.
123124 const instance2 = new Application ( {
124125 ...baseApp ,
125126 instances : [
@@ -132,15 +133,17 @@ describe('DetailsHealth', () => {
132133 } ) . instances [ 0 ] ;
133134 instance2 . fetchCachedHealthGroups = vi
134135 . fn ( )
135- . mockResolvedValue ( { data : [ ] } ) ;
136+ . mockResolvedValue ( { data : [ 'liveness' , 'readiness' ] } ) ;
136137
137138 await rerender ( { instance : instance2 } ) ;
138139
139- // Original instance's mock should still be 1 (no additional calls)
140- expect ( instance1 . fetchCachedHealthGroups ) . toHaveBeenCalledTimes ( 1 ) ;
140+ // The new instance's cached groups should have been fetched on the SSE update.
141+ await waitFor ( ( ) => {
142+ expect ( instance2 . fetchCachedHealthGroups ) . toHaveBeenCalledTimes ( 1 ) ;
143+ } ) ;
141144 } ) ;
142145
143- it ( 'should reactively update through multiple SSE status changes without extra HTTP calls ' , async ( ) => {
146+ it ( 'should reactively update health status and details through SSE status changes ' , async ( ) => {
144147 const baseApp = applications [ 0 ] ;
145148
146149 const instance1 = new Application ( baseApp ) . instances [ 0 ] ;
0 commit comments