@@ -139,8 +139,8 @@ describe('EndorsementApprovalComponent', () => {
139
139
expect ( emittedFiscal ! . businessAreaComment ) . toBe ( 'New approval' ) ;
140
140
} ) ;
141
141
142
- it ( 'should set planFiscalStatusCode to DRAFT if endorsement removed' , async ( ) => {
143
- spyOn < any > ( component , 'confirmRevertToDraft ' ) . and . returnValue ( Promise . resolve ( true ) ) ;
142
+ it ( 'should set planFiscalStatusCode to PROPOSED if endorsement removed' , async ( ) => {
143
+ spyOn < any > ( component , 'confirmRevertToProposed ' ) . and . returnValue ( Promise . resolve ( true ) ) ;
144
144
145
145
const emitSpy = spyOn ( component . saveEndorsement , 'emit' ) ;
146
146
component . fiscal = {
@@ -155,7 +155,7 @@ describe('EndorsementApprovalComponent', () => {
155
155
await component . onSave ( ) ;
156
156
157
157
const emittedFiscal = emitSpy . calls . mostRecent ( ) ! . args [ 0 ] ;
158
- expect ( emittedFiscal ! . planFiscalStatusCode ?. planFiscalStatusCode ) . toBe ( FiscalStatuses . DRAFT ) ;
158
+ expect ( emittedFiscal ! . planFiscalStatusCode ?. planFiscalStatusCode ) . toBe ( FiscalStatuses . PROPOSED ) ;
159
159
} ) ;
160
160
161
161
it ( 'should disable the form' , ( ) => {
@@ -259,9 +259,8 @@ describe('EndorsementApprovalComponent', () => {
259
259
expect ( component . isSaving ) . toBeFalse ( ) ;
260
260
} ) ;
261
261
262
- it ( 'resets to DRAFT and clears fields when endorsement removed (confirm = true)' , async ( ) => {
263
- // Arrange (shouldResetToDraft → endorsementRemoved = true, status not DRAFT/PROPOSED)
264
- spyOn < any > ( component , 'confirmRevertToDraft' ) . and . returnValue ( Promise . resolve ( true ) ) ;
262
+ it ( 'resets to PROPOSED and clears fields when endorsement removed (confirm = true)' , async ( ) => {
263
+ spyOn < any > ( component , 'confirmRevertToProposed' ) . and . returnValue ( Promise . resolve ( true ) ) ;
265
264
const emitSpy = spyOn ( component . saveEndorsement , 'emit' ) ;
266
265
267
266
component . fiscal = {
@@ -285,11 +284,9 @@ describe('EndorsementApprovalComponent', () => {
285
284
const { args } = emitSpy . calls . mostRecent ( ) ;
286
285
const payload = args [ 0 ] as ProjectFiscal ;
287
286
288
- // Forced DRAFT
289
- expect ( payload . planFiscalStatusCode . planFiscalStatusCode ) . toBe ( FiscalStatuses . DRAFT ) ;
290
- // Approval forced false
291
- expect ( payload . isApprovedInd ) . toBeFalse ( ) ;
292
-
287
+ // Forced PROPOSED
288
+ expect ( payload . planFiscalStatusCode . planFiscalStatusCode ) . toBe ( FiscalStatuses . PROPOSED ) ;
289
+
293
290
// Endorsement cleared
294
291
expect ( payload . endorserName ) . toBeUndefined ( ) ;
295
292
expect ( payload . endorsementTimestamp ) . toBeUndefined ( ) ;
@@ -298,21 +295,12 @@ describe('EndorsementApprovalComponent', () => {
298
295
expect ( payload . endorsementEvalTimestamp ) . toBeUndefined ( ) ;
299
296
expect ( payload . endorserUserGuid ) . toBeUndefined ( ) ;
300
297
expect ( payload . endorserUserUserid ) . toBeUndefined ( ) ;
301
-
302
- // Approval cleared
303
- expect ( payload . approvedTimestamp ) . toBeUndefined ( ) ;
304
- expect ( payload . approverName ) . toBeUndefined ( ) ;
305
- expect ( payload . approverUserGuid ) . toBeUndefined ( ) ;
306
- expect ( payload . approverUserUserid ) . toBeUndefined ( ) ;
307
- expect ( payload . businessAreaComment ) . toBeUndefined ( ) ;
308
-
309
- // Audit cleared per current implementation
310
298
expect ( payload . endorseApprUpdateUserid ) . toBeUndefined ( ) ;
311
299
expect ( payload . endorseApprUpdatedTimestamp ) . toBeUndefined ( ) ;
312
300
} ) ;
313
301
314
- it ( 'resets to DRAFT and clears fields when approval removed (confirm = true)' , async ( ) => {
315
- spyOn < any > ( component , 'confirmRevertToDraft ' ) . and . returnValue ( Promise . resolve ( true ) ) ;
302
+ it ( 'resets to proposed and clears fields when approval removed (confirm = true)' , async ( ) => {
303
+ spyOn < any > ( component , 'confirmRevertToProposed ' ) . and . returnValue ( Promise . resolve ( true ) ) ;
316
304
const emitSpy = spyOn ( component . saveEndorsement , 'emit' ) ;
317
305
318
306
component . fiscal = {
@@ -333,23 +321,17 @@ describe('EndorsementApprovalComponent', () => {
333
321
const { args } = emitSpy . calls . mostRecent ( ) ;
334
322
const payload = args [ 0 ] as ProjectFiscal ;
335
323
336
- expect ( payload . planFiscalStatusCode . planFiscalStatusCode ) . toBe ( FiscalStatuses . DRAFT ) ;
324
+ expect ( payload . planFiscalStatusCode . planFiscalStatusCode ) . toBe ( FiscalStatuses . PROPOSED ) ;
337
325
expect ( payload . isApprovedInd ) . toBeFalse ( ) ;
338
326
expect ( payload . approvedTimestamp ) . toBeUndefined ( ) ;
339
327
expect ( payload . approverName ) . toBeUndefined ( ) ;
340
328
expect ( payload . approverUserGuid ) . toBeUndefined ( ) ;
341
329
expect ( payload . approverUserUserid ) . toBeUndefined ( ) ;
342
330
expect ( payload . businessAreaComment ) . toBeUndefined ( ) ;
343
- expect ( payload . endorserName ) . toBeUndefined ( ) ;
344
- expect ( payload . endorsementTimestamp ) . toBeUndefined ( ) ;
345
- expect ( payload . endorsementCode ) . toEqual ( { endorsementCode : EndorsementCode . NOT_ENDORS } ) ;
346
- expect ( payload . endorsementComment ) . toBeUndefined ( ) ;
347
- expect ( payload . endorseApprUpdateUserid ) . toBeUndefined ( ) ;
348
- expect ( payload . endorseApprUpdatedTimestamp ) . toBeUndefined ( ) ;
349
331
} ) ;
350
332
351
- it ( 'does not emit when user cancels the revert confirmation (shouldResetToDraft = true) ' , async ( ) => {
352
- spyOn < any > ( component , 'confirmRevertToDraft ' ) . and . returnValue ( Promise . resolve ( false ) ) ;
333
+ it ( 'does not emit when user cancels the revert confirmation' , async ( ) => {
334
+ spyOn < any > ( component , 'confirmRevertToProposed ' ) . and . returnValue ( Promise . resolve ( false ) ) ;
353
335
const emitSpy = spyOn ( component . saveEndorsement , 'emit' ) ;
354
336
355
337
component . fiscal = {
@@ -367,8 +349,8 @@ describe('EndorsementApprovalComponent', () => {
367
349
expect ( emitSpy ) . not . toHaveBeenCalled ( ) ;
368
350
} ) ;
369
351
370
- it ( 'calls confirmRevertToDraft with the current status when reverting' , async ( ) => {
371
- const confirmSpy = spyOn < any > ( component , 'confirmRevertToDraft ' ) . and . returnValue ( Promise . resolve ( true ) ) ;
352
+ it ( 'calls confirmRevertToProposed with the current status when reverting' , async ( ) => {
353
+ const confirmSpy = spyOn < any > ( component , 'confirmRevertToProposed ' ) . and . returnValue ( Promise . resolve ( true ) ) ;
372
354
const emitSpy = spyOn ( component . saveEndorsement , 'emit' ) ;
373
355
374
356
component . fiscal = {
0 commit comments