@@ -29,6 +29,8 @@ describe('StatusService', () => {
2929 'services.status.approverAdded' : 'Approver added' ,
3030 'services.status.approverPending' : 'Approver pending' ,
3131 'services.status.approverRemoved' : 'Approver removed' ,
32+ 'services.status.approvalsReset' : 'Approvals reset' ,
33+ 'services.status.cardExpenseMerged' : 'Card expense merged' ,
3234 'services.status.cardExpenseRemoved' : 'Card expense removed' ,
3335 'services.status.cardTransactionMatched' : 'Card transaction matched' ,
3436 'services.status.criticalPolicyViolation' : 'Critical policy violation found' ,
@@ -37,6 +39,7 @@ describe('StatusService', () => {
3739 'services.status.duplicateIssueResolved' : 'Duplicate(s) issue resolved' ,
3840 'services.status.expense' : 'Expense' ,
3941 'services.status.expenseAdded' : 'Expense added' ,
42+ 'services.status.expenseApproved' : 'Expense approved' ,
4043 'services.status.expenseAutomaticallyMerged' : 'Expense automatically merged' ,
4144 'services.status.expenseIssues' : 'Expense issues' ,
4245 'services.status.expenseMatched' : 'Expense matched' ,
@@ -45,10 +48,12 @@ describe('StatusService', () => {
4548 'services.status.expenseRemoved' : 'Expense removed' ,
4649 'services.status.expenseReportApproved' : 'Expense report approved' ,
4750 'services.status.expenseRuleApplied' : 'Expense rule applied' ,
51+ 'services.status.expenseSplit' : 'Expense split' ,
4852 'services.status.expenseUnlinked' : 'Expense unlinked' ,
4953 'services.status.expenseUnmatched' : 'Expense unmatched' ,
5054 'services.status.expenseVerificationUndone' : 'Expense verification undone' ,
5155 'services.status.expenseVerified' : 'Expense verified' ,
56+ 'services.status.expensesAdded' : 'Expense(s) added' ,
5257 'services.status.expensesMergedToThisExpense' : '{{count}} expenses merged to this expense' ,
5358 'services.status.failedToRunPolicies' : 'Failed to run policies' ,
5459 'services.status.flagged' : 'Flagged' ,
@@ -247,10 +252,10 @@ describe('StatusService', () => {
247252 expect ( result . icon ) . toBe ( 'check' ) ;
248253 } ) ;
249254
250- it ( 'should return "Expense" for matched by comments' , ( ) => {
255+ it ( 'should return "Expense matched " for matched by comments' , ( ) => {
251256 const comment = 'Expense matched by John Doe [email protected] ' ; 252257 const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
253- expect ( result . category ) . toBe ( 'Expense' ) ;
258+ expect ( result . category ) . toBe ( 'Expense matched ' ) ;
254259 expect ( result . icon ) . toBe ( 'check' ) ;
255260 } ) ;
256261
@@ -303,10 +308,10 @@ describe('StatusService', () => {
303308 expect ( result . icon ) . toBe ( 'check' ) ;
304309 } ) ;
305310
306- it ( 'should return "Expense report approved" for approved by admin comments' , ( ) => {
311+ it ( 'should return "Reports approved" for approved by admin comments' , ( ) => {
307312 const comment = 'Expense report approved by admin' ;
308313 const result = statusService . getStatusCategory ( comment , 'reports' ) ;
309- expect ( result . category ) . toBe ( 'Expense report approved' ) ;
314+ expect ( result . category ) . toBe ( 'Reports approved' ) ;
310315 expect ( result . icon ) . toBe ( 'check' ) ;
311316 } ) ;
312317
@@ -345,4 +350,123 @@ describe('StatusService', () => {
345350 expect ( result . us_full_name ) . toBeNull ( ) ;
346351 expect ( result . us_email ) . toBeNull ( ) ;
347352 } ) ;
353+
354+ it ( 'should return "Expense merged" for generic merged comments' , ( ) => {
355+ const comment = 'Expense merged by [email protected] ' ; 356+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
357+ expect ( result . category ) . toBe ( 'Expense merged' ) ;
358+ expect ( result . icon ) . toBe ( 'check' ) ;
359+ } ) ;
360+
361+ it ( 'should return "Card expense merged" for expense merged automatically comments' , ( ) => {
362+ const comment = 'Expense merged automatically by system' ;
363+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
364+ expect ( result . category ) . toBe ( 'Card expense merged' ) ;
365+ expect ( result . icon ) . toBe ( 'check' ) ;
366+ } ) ;
367+
368+ it ( 'should return "Expense(s) added" for expense(s) added to report comments' , ( ) => {
369+ const comment = 'expense(s) added to report by [email protected] ' ; 370+ const result = statusService . getStatusCategory ( comment , 'reports' ) ;
371+ expect ( result . category ) . toBe ( 'Expense(s) added' ) ;
372+ expect ( result . icon ) . toBe ( 'check' ) ;
373+ } ) ;
374+
375+ it ( 'should return "Report name changed" for name was changed from comments' , ( ) => {
376+ const comment = 'Report name was changed from "Old Name" to "New Name"' ;
377+ const result = statusService . getStatusCategory ( comment , 'reports' ) ;
378+ expect ( result . category ) . toBe ( 'Report name changed' ) ;
379+ expect ( result . icon ) . toBe ( 'check' ) ;
380+ } ) ;
381+
382+ it ( 'should return "Unflagged" for unflagged comments' , ( ) => {
383+ const comment = 'Expense unflagged by [email protected] ' ; 384+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
385+ expect ( result . category ) . toBe ( 'Unflagged' ) ;
386+ expect ( result . icon ) . toBe ( 'check' ) ;
387+ } ) ;
388+
389+ it ( 'should return "Flagged" for flagged comments' , ( ) => {
390+ const comment = 'Expense flagged by system' ;
391+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
392+ expect ( result . category ) . toBe ( 'Flagged' ) ;
393+ expect ( result . icon ) . toBe ( 'danger-outline' ) ;
394+ } ) ;
395+
396+ it ( 'should return "Expense split" for expense split comments' , ( ) => {
397+ const comment = 'Expense split by [email protected] ' ; 398+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
399+ expect ( result . category ) . toBe ( 'Expense split' ) ;
400+ expect ( result . icon ) . toBe ( 'check' ) ;
401+ } ) ;
402+
403+ it ( 'should return "Verified" for generic verified comments' , ( ) => {
404+ const comment = 'Report verified by [email protected] ' ; 405+ const result = statusService . getStatusCategory ( comment , 'reports' ) ;
406+ expect ( result . category ) . toBe ( 'Verified' ) ;
407+ expect ( result . icon ) . toBe ( 'check' ) ;
408+ } ) ;
409+
410+ it ( 'should return "Approvals reset" for approvals reset comments' , ( ) => {
411+ const comment = 'Approvals reset by [email protected] ' ; 412+ const result = statusService . getStatusCategory ( comment , 'reports' ) ;
413+ expect ( result . category ) . toBe ( 'Approvals reset' ) ;
414+ expect ( result . icon ) . toBe ( 'check' ) ;
415+ } ) ;
416+
417+ it ( 'should return "Policies ran successfully" for policies ran successfully comments' , ( ) => {
418+ const comment = 'Policies ran successfully on this expense' ;
419+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
420+ expect ( result . category ) . toBe ( 'Policies ran successfully' ) ;
421+ expect ( result . icon ) . toBe ( 'check' ) ;
422+ } ) ;
423+
424+ it ( 'should return "Card transaction matched" for auto-matched by comments' , ( ) => {
425+ const comment = 'Expense auto-matched by system' ;
426+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
427+ expect ( result . category ) . toBe ( 'Card transaction matched' ) ;
428+ expect ( result . icon ) . toBe ( 'check' ) ;
429+ } ) ;
430+
431+ it ( 'should return "Expense unmatched" for unmatched by comments' , ( ) => {
432+ const comment = 'Expense unmatched by [email protected] ' ; 433+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
434+ expect ( result . category ) . toBe ( 'Expense unmatched' ) ;
435+ expect ( result . icon ) . toBe ( 'check' ) ;
436+ } ) ;
437+
438+ it ( 'should return "Approver pending" for approver_pending comments' , ( ) => {
439+ const comment = 'approver_pending status set by system' ;
440+ const result = statusService . getStatusCategory ( comment , 'reports' ) ;
441+ expect ( result . category ) . toBe ( 'Approver pending' ) ;
442+ expect ( result . icon ) . toBe ( 'check' ) ;
443+ } ) ;
444+
445+ it ( 'should return "Processing payment" for payment_processing comments' , ( ) => {
446+ const comment = 'payment_processing status set by system' ;
447+ const result = statusService . getStatusCategory ( comment , 'reports' ) ;
448+ expect ( result . category ) . toBe ( 'Processing payment' ) ;
449+ expect ( result . icon ) . toBe ( 'check' ) ;
450+ } ) ;
451+
452+ it ( 'should return "Expense issues" for expense issues comments' , ( ) => {
453+ const comment = 'Expense issues detected by system' ;
454+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
455+ expect ( result . category ) . toBe ( 'Expense issues' ) ;
456+ expect ( result . icon ) . toBe ( 'danger-outline' ) ;
457+ } ) ;
458+
459+ it ( 'should return "Duplicate detected" for expense is a possible duplicate comments' , ( ) => {
460+ const comment = 'This expense is a possible duplicate of another expense' ;
461+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
462+ expect ( result . category ) . toBe ( 'Duplicate detected' ) ;
463+ expect ( result . icon ) . toBe ( 'danger-outline' ) ;
464+ } ) ;
465+
466+ it ( 'should return "Duplicate(s) issue resolved" for duplicate expense(s) with similar details comments' , ( ) => {
467+ const comment = 'duplicate expense(s) with similar details have been resolved' ;
468+ const result = statusService . getStatusCategory ( comment , 'transactions' ) ;
469+ expect ( result . category ) . toBe ( 'Duplicate(s) issue resolved' ) ;
470+ expect ( result . icon ) . toBe ( 'check' ) ;
471+ } ) ;
348472} ) ;
0 commit comments