@@ -118,6 +118,27 @@ describe('getOperationType', () => {
118118 } ) ;
119119} ) ;
120120
121+ const healthyApplicationSetConditions = [
122+ {
123+ type : 'ErrorOccurred' ,
124+ status : 'False' ,
125+ reason : 'ApplicationSetUpToDate' ,
126+ message : 'All applications have been generated successfully' ,
127+ } ,
128+ {
129+ type : 'ParametersGenerated' ,
130+ status : 'True' ,
131+ reason : 'ParametersGenerated' ,
132+ message : 'Successfully generated parameters for all Applications' ,
133+ } ,
134+ {
135+ type : 'ResourcesUpToDate' ,
136+ status : 'True' ,
137+ reason : 'ApplicationSetUpToDate' ,
138+ message : 'All applications have been generated successfully' ,
139+ } ,
140+ ] ;
141+
121142describe ( 'getAppSetStatus' , ( ) => {
122143 it ( 'determines ApplicationSet status' , ( ) => {
123144 expect (
@@ -140,4 +161,34 @@ describe('getAppSetStatus', () => {
140161
141162 expect ( getAppSetStatus ( { } as any ) ) . toMatchInlineSnapshot ( `"Unknown"` ) ;
142163 } ) ;
164+
165+ it ( 'returns Healthy for realistic upstream conditions (ResourcesUpToDate=True)' , ( ) => {
166+ expect (
167+ getAppSetStatus ( {
168+ status : { conditions : healthyApplicationSetConditions } ,
169+ } as any ) ,
170+ ) . toBe ( 'Healthy' ) ;
171+ } ) ;
172+
173+ it ( 'returns Error when ResourcesUpToDate is False' , ( ) => {
174+ expect (
175+ getAppSetStatus ( {
176+ status : {
177+ conditions : [
178+ { type : 'ErrorOccurred' , status : 'False' } ,
179+ { type : 'ParametersGenerated' , status : 'True' } ,
180+ { type : 'ResourcesUpToDate' , status : 'False' , reason : 'ErrorOccurred' } ,
181+ ] ,
182+ } ,
183+ } as any ) ,
184+ ) . toBe ( 'Error' ) ;
185+ } ) ;
186+
187+ it ( 'does not treat ApplicationSetUpToDate reason as a condition type' , ( ) => {
188+ expect (
189+ getAppSetStatus ( {
190+ status : { conditions : [ { type : 'ApplicationSetUpToDate' , status : 'True' } ] } ,
191+ } as any ) ,
192+ ) . toBe ( 'Healthy' ) ;
193+ } ) ;
143194} ) ;
0 commit comments