@@ -735,12 +735,12 @@ describe('DebugUtils', () => {
735735 Onyx . clear ( ) ;
736736 } ) ;
737737 it ( 'returns null when report is not defined' , ( ) => {
738- const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : undefined , chatReport : chatReportR14932 } ) ;
738+ const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : undefined , chatReport : chatReportR14932 , doesReportHaveViolations : false } ) ;
739739 expect ( reason ) . toBeNull ( ) ;
740740 } ) ;
741741 it ( 'returns correct reason when report has a valid draft comment' , async ( ) => {
742742 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT_DRAFT_COMMENT } 1` , 'Hello world!' ) ;
743- const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : baseReport , chatReport : chatReportR14932 } ) ;
743+ const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : baseReport , chatReport : chatReportR14932 , doesReportHaveViolations : false } ) ;
744744 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.hasDraftComment' ) ;
745745 } ) ;
746746 it ( 'returns correct reason when report has GBR' , ( ) => {
@@ -751,6 +751,7 @@ describe('DebugUtils', () => {
751751 lastReadTime : '2024-08-08 18:70:44.171' ,
752752 } ,
753753 chatReport : chatReportR14932 ,
754+ doesReportHaveViolations : false ,
754755 } ) ;
755756 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.hasGBR' ) ;
756757 } ) ;
@@ -761,6 +762,7 @@ describe('DebugUtils', () => {
761762 isPinned : true ,
762763 } ,
763764 chatReport : chatReportR14932 ,
765+ doesReportHaveViolations : false ,
764766 } ) ;
765767 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.pinnedByUser' ) ;
766768 } ) ;
@@ -775,6 +777,7 @@ describe('DebugUtils', () => {
775777 } ,
776778 } ,
777779 chatReport : chatReportR14932 ,
780+ doesReportHaveViolations : false ,
778781 } ) ;
779782 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.hasAddWorkspaceRoomErrors' ) ;
780783 } ) ;
@@ -797,6 +800,7 @@ describe('DebugUtils', () => {
797800 } ,
798801 chatReport : chatReportR14932 ,
799802 isInFocusMode : true ,
803+ doesReportHaveViolations : false ,
800804 } ) ;
801805 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.isUnread' ) ;
802806 } ) ;
@@ -813,6 +817,7 @@ describe('DebugUtils', () => {
813817 chatReport : chatReportR14932 ,
814818 hasRBR : false ,
815819 isReportArchived : isReportArchived . current ,
820+ doesReportHaveViolations : false ,
816821 } ) ;
817822 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.isArchived' ) ;
818823 } ) ;
@@ -823,13 +828,15 @@ describe('DebugUtils', () => {
823828 chatType : CONST . REPORT . CHAT_TYPE . SELF_DM ,
824829 } ,
825830 chatReport : chatReportR14932 ,
831+ doesReportHaveViolations : false ,
826832 } ) ;
827833 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.isSelfDM' ) ;
828834 } ) ;
829835 it ( 'returns correct reason when report is temporarily focused' , ( ) => {
830836 const reason = DebugUtils . getReasonForShowingRowInLHN ( {
831837 report : baseReport ,
832838 chatReport : chatReportR14932 ,
839+ doesReportHaveViolations : false ,
833840 } ) ;
834841 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.isFocused' ) ;
835842 } ) ;
@@ -881,14 +888,8 @@ describe('DebugUtils', () => {
881888 modifiedAmount : 10 ,
882889 reportID : '1' ,
883890 } ,
884- [ `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } 1` as const ] : [
885- {
886- type : CONST . VIOLATION_TYPES . VIOLATION ,
887- name : CONST . VIOLATIONS . MISSING_CATEGORY ,
888- } ,
889- ] ,
890891 } ) ;
891- const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : MOCK_TRANSACTION_REPORT , chatReport : chatReportR14932 , hasRBR : true } ) ;
892+ const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : MOCK_TRANSACTION_REPORT , chatReport : chatReportR14932 , hasRBR : true , doesReportHaveViolations : true } ) ;
892893 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.hasRBR' ) ;
893894 } ) ;
894895 it ( 'returns correct reason when report has violations' , async ( ) => {
@@ -939,18 +940,12 @@ describe('DebugUtils', () => {
939940 modifiedAmount : 10 ,
940941 reportID : '1' ,
941942 } ,
942- [ `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } 1` as const ] : [
943- {
944- type : CONST . VIOLATION_TYPES . VIOLATION ,
945- name : CONST . VIOLATIONS . MISSING_CATEGORY ,
946- } ,
947- ] ,
948943 } ) ;
949- const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : MOCK_EXPENSE_REPORT , chatReport : chatReportR14932 , hasRBR : true } ) ;
944+ const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : MOCK_EXPENSE_REPORT , chatReport : chatReportR14932 , hasRBR : true , doesReportHaveViolations : true } ) ;
950945 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.hasRBR' ) ;
951946 } ) ;
952947 it ( 'returns correct reason when report has errors' , ( ) => {
953- const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : baseReport , chatReport : chatReportR14932 , hasRBR : true } ) ;
948+ const reason = DebugUtils . getReasonForShowingRowInLHN ( { report : baseReport , chatReport : chatReportR14932 , hasRBR : true , doesReportHaveViolations : false } ) ;
954949 expect ( reason ) . toBe ( 'debug.reasonVisibleInLHN.hasRBR' ) ;
955950 } ) ;
956951 } ) ;
@@ -1148,6 +1143,7 @@ describe('DebugUtils', () => {
11481143 chatReportR14932 ,
11491144 undefined ,
11501145 { } ,
1146+ undefined ,
11511147 false ,
11521148 { } ,
11531149 ) ?? { } ;
@@ -1202,6 +1198,7 @@ describe('DebugUtils', () => {
12021198 chatReportR14932 ,
12031199 undefined ,
12041200 { } ,
1201+ undefined ,
12051202 false ,
12061203 { } ,
12071204 ) ?? { } ;
@@ -1263,7 +1260,8 @@ describe('DebugUtils', () => {
12631260 } ,
12641261 } ) ;
12651262 const reportErrors = getAllReportErrors ( MOCK_IOU_REPORT , MOCK_REPORT_ACTIONS ) ;
1266- const { reportAction} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_IOU_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , false , reportErrors ) ?? { } ;
1263+ const { reportAction} =
1264+ DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_IOU_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , undefined , false , reportErrors ) ?? { } ;
12671265 expect ( reportAction ) . toMatchObject ( MOCK_REPORT_ACTIONS [ '3' ] ) ;
12681266 } ) ;
12691267 } ) ;
@@ -1322,7 +1320,8 @@ describe('DebugUtils', () => {
13221320 } ,
13231321 } ) ;
13241322 const reportErrors = getAllReportErrors ( MOCK_IOU_REPORT , MOCK_REPORT_ACTIONS ) ;
1325- const { reportAction} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_IOU_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , false , reportErrors ) ?? { } ;
1323+ const { reportAction} =
1324+ DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_IOU_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , undefined , false , reportErrors ) ?? { } ;
13261325 expect ( reportAction ) . toMatchObject ( MOCK_REPORT_ACTIONS [ '3' ] ) ;
13271326 } ) ;
13281327 } ) ;
@@ -1382,7 +1381,8 @@ describe('DebugUtils', () => {
13821381 } ,
13831382 } ) ;
13841383 const reportErrors = getAllReportErrors ( MOCK_CHAT_REPORT , MOCK_CHAT_REPORT_ACTIONS ) ;
1385- const { reportAction} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_CHAT_REPORT , chatReportR14932 , MOCK_CHAT_REPORT_ACTIONS , { } , false , reportErrors ) ?? { } ;
1384+ const { reportAction} =
1385+ DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_CHAT_REPORT , chatReportR14932 , MOCK_CHAT_REPORT_ACTIONS , { } , undefined , false , reportErrors ) ?? { } ;
13861386 expect ( reportAction ) . toMatchObject ( MOCK_CHAT_REPORT_ACTIONS [ '1' ] ) ;
13871387 } ) ;
13881388 it ( 'returns correct report action which is a split bill and has an error' , async ( ) => {
@@ -1445,7 +1445,8 @@ describe('DebugUtils', () => {
14451445 } ,
14461446 } ) ;
14471447 const reportErrors = getAllReportErrors ( MOCK_CHAT_REPORT , MOCK_REPORT_ACTIONS ) ;
1448- const { reportAction} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_CHAT_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , false , reportErrors ) ?? { } ;
1448+ const { reportAction} =
1449+ DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_CHAT_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , undefined , false , reportErrors ) ?? { } ;
14491450 expect ( reportAction ) . toMatchObject ( MOCK_REPORT_ACTIONS [ '3' ] ) ;
14501451 } ) ;
14511452 it ( "returns undefined if there's no report action is a report preview or a split bill" , async ( ) => {
@@ -1502,7 +1503,8 @@ describe('DebugUtils', () => {
15021503 } ,
15031504 } ) ;
15041505 const reportErrors = getAllReportErrors ( MOCK_IOU_REPORT , MOCK_REPORT_ACTIONS ) ;
1505- const { reportAction} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_IOU_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , false , reportErrors ) ?? { } ;
1506+ const { reportAction} =
1507+ DebugUtils . getReasonAndReportActionForRBRInLHNRow ( MOCK_IOU_REPORT , chatReportR14932 , MOCK_REPORT_ACTIONS , { } , undefined , false , reportErrors ) ?? { } ;
15061508 expect ( reportAction ) . toMatchObject ( MOCK_REPORT_ACTIONS [ '3' ] ) ;
15071509 } ) ;
15081510 } ) ;
@@ -1557,6 +1559,7 @@ describe('DebugUtils', () => {
15571559 chatReportR14932 ,
15581560 MOCK_REPORT_ACTIONS ,
15591561 { } ,
1562+ undefined ,
15601563 false ,
15611564 reportErrors ,
15621565 ) ?? { } ;
@@ -1586,7 +1589,7 @@ describe('DebugUtils', () => {
15861589 } ;
15871590
15881591 const reportErrors = getAllReportErrors ( mockedReport , mockedReportActions ) ;
1589- const { reason} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( mockedReport , chatReportR14932 , mockedReportActions , { } , false , reportErrors ) ?? { } ;
1592+ const { reason} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( mockedReport , chatReportR14932 , mockedReportActions , { } , undefined , false , reportErrors ) ?? { } ;
15901593 expect ( reason ) . toBe ( 'debug.reasonRBR.hasErrors' ) ;
15911594 } ) ;
15921595 it ( 'returns correct reason when there are violations' , ( ) => {
@@ -1598,6 +1601,7 @@ describe('DebugUtils', () => {
15981601 chatReportR14932 ,
15991602 undefined ,
16001603 { } ,
1604+ undefined ,
16011605 true ,
16021606 { } ,
16031607 ) ?? { } ;
@@ -1612,6 +1616,7 @@ describe('DebugUtils', () => {
16121616 chatReportR14932 ,
16131617 undefined ,
16141618 { } ,
1619+ undefined ,
16151620 true ,
16161621 { } ,
16171622 true ,
@@ -1626,6 +1631,15 @@ describe('DebugUtils', () => {
16261631 policyID : '1' ,
16271632 chatType : CONST . REPORT . CHAT_TYPE . POLICY_EXPENSE_CHAT ,
16281633 } ;
1634+ const transactionViolations = {
1635+ [ `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } 1` as const ] : [
1636+ {
1637+ type : CONST . VIOLATION_TYPES . VIOLATION ,
1638+ name : CONST . VIOLATIONS . MISSING_CATEGORY ,
1639+ showInReview : true ,
1640+ } ,
1641+ ] ,
1642+ } ;
16291643 await Onyx . multiSet ( {
16301644 [ ONYXKEYS . SESSION ] : {
16311645 accountID : 1234 ,
@@ -1652,7 +1666,7 @@ describe('DebugUtils', () => {
16521666 } ,
16531667 ] ,
16541668 } ) ;
1655- const { reason} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( report , chatReportR14932 , { } , { } , false , { } ) ?? { } ;
1669+ const { reason} = DebugUtils . getReasonAndReportActionForRBRInLHNRow ( report , chatReportR14932 , { } , { } , transactionViolations , false , { } ) ?? { } ;
16561670 expect ( reason ) . toBe ( 'debug.reasonRBR.hasTransactionThreadViolations' ) ;
16571671 } ) ;
16581672 } ) ;
0 commit comments