@@ -1140,7 +1140,7 @@ describe('ReportUtils', () => {
11401140 ...LHNTestUtils . getFakeReport ( ) ,
11411141 parentReportID : '102' ,
11421142 type : CONST . REPORT . TYPE . EXPENSE ,
1143- managerID : currentUserAccountID ,
1143+ ownerAccountID : currentUserAccountID ,
11441144 } ;
11451145 const moneyRequestOptions = temporary_getMoneyRequestOptions ( report , undefined , [ currentUserAccountID ] ) ;
11461146 expect ( moneyRequestOptions . length ) . toBe ( 2 ) ;
@@ -1162,7 +1162,7 @@ describe('ReportUtils', () => {
11621162 stateNum : CONST . REPORT . STATE_NUM . OPEN ,
11631163 statusNum : CONST . REPORT . STATUS_NUM . OPEN ,
11641164 parentReportID : '103' ,
1165- managerID : currentUserAccountID ,
1165+ ownerAccountID : currentUserAccountID ,
11661166 } ;
11671167 const paidPolicy = {
11681168 type : CONST . POLICY . TYPE . TEAM ,
@@ -1293,6 +1293,7 @@ describe('ReportUtils', () => {
12931293 statusNum : CONST . REPORT . STATUS_NUM . SUBMITTED ,
12941294 parentReportID : '101' ,
12951295 policyID : paidPolicy . id ,
1296+ ownerAccountID : currentUserAccountID ,
12961297 } ;
12971298 const moneyRequestOptions = temporary_getMoneyRequestOptions ( report , paidPolicy , [ currentUserAccountID , participantsAccountIDs . at ( 0 ) ?? CONST . DEFAULT_NUMBER_ID ] ) ;
12981299 expect ( moneyRequestOptions . length ) . toBe ( 2 ) ;
@@ -3753,6 +3754,7 @@ describe('ReportUtils', () => {
37533754 const report : Report = {
37543755 ...createRandomReport ( 10000 ) ,
37553756 type : CONST . REPORT . TYPE . EXPENSE ,
3757+ ownerAccountID : currentUserAccountID ,
37563758 } ;
37573759 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , report ) ;
37583760
@@ -3765,11 +3767,27 @@ describe('ReportUtils', () => {
37653767 expect ( result ) . toBe ( true ) ;
37663768 } ) ;
37673769
3770+ it ( 'should return false for an expense report the current user is not the submitter' , async ( ) => {
3771+ // Given an expense report the current user is not the submitter
3772+ const report : Report = {
3773+ ...createRandomReport ( 10000 ) ,
3774+ type : CONST . REPORT . TYPE . EXPENSE ,
3775+ ownerAccountID : currentUserAccountID + 1 ,
3776+ } ;
3777+ await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , report ) ;
3778+
3779+ const result = canAddTransaction ( report , false ) ;
3780+
3781+ // Then the result is false
3782+ expect ( result ) . toBe ( false ) ;
3783+ } ) ;
3784+
37683785 it ( 'should return false for an archived report' , async ( ) => {
37693786 // Given an archived expense report
37703787 const report : Report = {
37713788 ...createRandomReport ( 10001 ) ,
37723789 type : CONST . REPORT . TYPE . EXPENSE ,
3790+ ownerAccountID : currentUserAccountID ,
37733791 } ;
37743792 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , report ) ;
37753793 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS } ${ report . reportID } ` , { private_isArchived : DateUtils . getDBTime ( ) } ) ;
0 commit comments