@@ -1024,7 +1024,7 @@ describe('ReportUtils', () => {
10241024 ...LHNTestUtils . getFakeReport ( ) ,
10251025 parentReportID : '102' ,
10261026 type : CONST . REPORT . TYPE . EXPENSE ,
1027- managerID : currentUserAccountID ,
1027+ ownerAccountID : currentUserAccountID ,
10281028 } ;
10291029 const moneyRequestOptions = temporary_getMoneyRequestOptions ( report , undefined , [ currentUserAccountID ] ) ;
10301030 expect ( moneyRequestOptions . length ) . toBe ( 2 ) ;
@@ -1046,7 +1046,7 @@ describe('ReportUtils', () => {
10461046 stateNum : CONST . REPORT . STATE_NUM . OPEN ,
10471047 statusNum : CONST . REPORT . STATUS_NUM . OPEN ,
10481048 parentReportID : '103' ,
1049- managerID : currentUserAccountID ,
1049+ ownerAccountID : currentUserAccountID ,
10501050 } ;
10511051 const paidPolicy = {
10521052 type : CONST . POLICY . TYPE . TEAM ,
@@ -1177,6 +1177,7 @@ describe('ReportUtils', () => {
11771177 statusNum : CONST . REPORT . STATUS_NUM . SUBMITTED ,
11781178 parentReportID : '101' ,
11791179 policyID : paidPolicy . id ,
1180+ ownerAccountID : currentUserAccountID ,
11801181 } ;
11811182 const moneyRequestOptions = temporary_getMoneyRequestOptions ( report , paidPolicy , [ currentUserAccountID , participantsAccountIDs . at ( 0 ) ?? CONST . DEFAULT_NUMBER_ID ] ) ;
11821183 expect ( moneyRequestOptions . length ) . toBe ( 2 ) ;
@@ -3593,6 +3594,7 @@ describe('ReportUtils', () => {
35933594 const report : Report = {
35943595 ...createRandomReport ( 10000 ) ,
35953596 type : CONST . REPORT . TYPE . EXPENSE ,
3597+ ownerAccountID : currentUserAccountID ,
35963598 } ;
35973599 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , report ) ;
35983600
@@ -3605,11 +3607,27 @@ describe('ReportUtils', () => {
36053607 expect ( result ) . toBe ( true ) ;
36063608 } ) ;
36073609
3610+ it ( 'should return false for an expense report the current user is not the submitter' , async ( ) => {
3611+ // Given an expense report the current user is not the submitter
3612+ const report : Report = {
3613+ ...createRandomReport ( 10000 ) ,
3614+ type : CONST . REPORT . TYPE . EXPENSE ,
3615+ ownerAccountID : currentUserAccountID + 1 ,
3616+ } ;
3617+ await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , report ) ;
3618+
3619+ const result = canAddTransaction ( report , false ) ;
3620+
3621+ // Then the result is false
3622+ expect ( result ) . toBe ( false ) ;
3623+ } ) ;
3624+
36083625 it ( 'should return false for an archived report' , async ( ) => {
36093626 // Given an archived expense report
36103627 const report : Report = {
36113628 ...createRandomReport ( 10001 ) ,
36123629 type : CONST . REPORT . TYPE . EXPENSE ,
3630+ ownerAccountID : currentUserAccountID ,
36133631 } ;
36143632 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , report ) ;
36153633 await Onyx . set ( `${ ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS } ${ report . reportID } ` , { private_isArchived : DateUtils . getDBTime ( ) } ) ;
0 commit comments