@@ -1363,17 +1363,13 @@ describe('getSecondaryAction', () => {
13631363 ownerAccountID : EMPLOYEE_ACCOUNT_ID ,
13641364 stateNum : CONST . REPORT . STATE_NUM . APPROVED ,
13651365 statusNum : CONST . REPORT . STATUS_NUM . APPROVED ,
1366+ total : - 100 ,
1367+ nonReimbursableTotal : 0 ,
13661368 } as unknown as Report ;
13671369 const policy = {
13681370 role : CONST . POLICY . ROLE . USER ,
13691371 } as unknown as Policy ;
13701372
1371- jest . spyOn ( ReportUtils , 'getMoneyRequestSpendBreakdown' ) . mockReturnValue ( {
1372- totalDisplaySpend : 100 ,
1373- reimbursableSpend : 100 ,
1374- nonReimbursableSpend : 0 ,
1375- } ) ;
1376-
13771373 const result = getSecondaryReportActions ( {
13781374 currentUserLogin : EMPLOYEE_EMAIL ,
13791375 currentUserAccountID : EMPLOYEE_ACCOUNT_ID ,
@@ -1389,24 +1385,20 @@ describe('getSecondaryAction', () => {
13891385 expect ( result . includes ( CONST . REPORT . SECONDARY_ACTIONS . RECEIVED_PAYMENT ) ) . toBe ( true ) ;
13901386 } ) ;
13911387
1392- it ( 'does not include RECEIVED_PAYMENT option for fully non-reimbursable expense report ' , ( ) => {
1388+ it ( 'includes RECEIVED_PAYMENT option for negative expense report even when non-reimbursable total matches total ' , ( ) => {
13931389 const report = {
13941390 reportID : REPORT_ID ,
13951391 type : CONST . REPORT . TYPE . EXPENSE ,
13961392 ownerAccountID : EMPLOYEE_ACCOUNT_ID ,
13971393 stateNum : CONST . REPORT . STATE_NUM . APPROVED ,
13981394 statusNum : CONST . REPORT . STATUS_NUM . APPROVED ,
1395+ total : - 100 ,
1396+ nonReimbursableTotal : - 100 ,
13991397 } as unknown as Report ;
14001398 const policy = {
14011399 role : CONST . POLICY . ROLE . USER ,
14021400 } as unknown as Policy ;
14031401
1404- jest . spyOn ( ReportUtils , 'getMoneyRequestSpendBreakdown' ) . mockReturnValue ( {
1405- totalDisplaySpend : 100 ,
1406- reimbursableSpend : 0 ,
1407- nonReimbursableSpend : 100 ,
1408- } ) ;
1409-
14101402 const result = getSecondaryReportActions ( {
14111403 currentUserLogin : EMPLOYEE_EMAIL ,
14121404 currentUserAccountID : EMPLOYEE_ACCOUNT_ID ,
@@ -1419,7 +1411,7 @@ describe('getSecondaryAction', () => {
14191411 policy,
14201412 reportActions : [ ] ,
14211413 } ) ;
1422- expect ( result . includes ( CONST . REPORT . SECONDARY_ACTIONS . RECEIVED_PAYMENT ) ) . toBe ( false ) ;
1414+ expect ( result . includes ( CONST . REPORT . SECONDARY_ACTIONS . RECEIVED_PAYMENT ) ) . toBe ( true ) ;
14231415 } ) ;
14241416
14251417 it ( 'does not include RECEIVED_PAYMENT option for admin' , ( ) => {
@@ -1429,17 +1421,13 @@ describe('getSecondaryAction', () => {
14291421 ownerAccountID : EMPLOYEE_ACCOUNT_ID ,
14301422 stateNum : CONST . REPORT . STATE_NUM . APPROVED ,
14311423 statusNum : CONST . REPORT . STATUS_NUM . APPROVED ,
1424+ total : - 100 ,
1425+ nonReimbursableTotal : 0 ,
14321426 } as unknown as Report ;
14331427 const policy = {
14341428 role : CONST . POLICY . ROLE . ADMIN ,
14351429 } as unknown as Policy ;
14361430
1437- jest . spyOn ( ReportUtils , 'getMoneyRequestSpendBreakdown' ) . mockReturnValue ( {
1438- totalDisplaySpend : 100 ,
1439- reimbursableSpend : 100 ,
1440- nonReimbursableSpend : 0 ,
1441- } ) ;
1442-
14431431 const result = getSecondaryReportActions ( {
14441432 currentUserLogin : EMPLOYEE_EMAIL ,
14451433 currentUserAccountID : EMPLOYEE_ACCOUNT_ID ,
@@ -1462,6 +1450,8 @@ describe('getSecondaryAction', () => {
14621450 ownerAccountID : EMPLOYEE_ACCOUNT_ID ,
14631451 stateNum : CONST . REPORT . STATE_NUM . APPROVED ,
14641452 statusNum : CONST . REPORT . STATUS_NUM . APPROVED ,
1453+ total : - 100 ,
1454+ nonReimbursableTotal : 0 ,
14651455 } as unknown as Report ;
14661456 const policy = {
14671457 role : CONST . POLICY . ROLE . USER ,
@@ -1474,12 +1464,6 @@ describe('getSecondaryAction', () => {
14741464 } ,
14751465 } as unknown as ReportAction ;
14761466
1477- jest . spyOn ( ReportUtils , 'getMoneyRequestSpendBreakdown' ) . mockReturnValue ( {
1478- totalDisplaySpend : 100 ,
1479- reimbursableSpend : 100 ,
1480- nonReimbursableSpend : 0 ,
1481- } ) ;
1482-
14831467 const result = getSecondaryReportActions ( {
14841468 currentUserLogin : EMPLOYEE_EMAIL ,
14851469 currentUserAccountID : EMPLOYEE_ACCOUNT_ID ,
@@ -1502,6 +1486,8 @@ describe('getSecondaryAction', () => {
15021486 ownerAccountID : EMPLOYEE_ACCOUNT_ID ,
15031487 stateNum : CONST . REPORT . STATE_NUM . APPROVED ,
15041488 statusNum : CONST . REPORT . STATUS_NUM . REIMBURSED ,
1489+ total : - 100 ,
1490+ nonReimbursableTotal : 0 ,
15051491 } as unknown as Report ;
15061492 const policy = {
15071493 role : CONST . POLICY . ROLE . USER ,
@@ -1514,12 +1500,6 @@ describe('getSecondaryAction', () => {
15141500 } ,
15151501 } as unknown as ReportAction ;
15161502
1517- jest . spyOn ( ReportUtils , 'getMoneyRequestSpendBreakdown' ) . mockReturnValue ( {
1518- totalDisplaySpend : 100 ,
1519- reimbursableSpend : 100 ,
1520- nonReimbursableSpend : 0 ,
1521- } ) ;
1522-
15231503 const result = getSecondaryReportActions ( {
15241504 currentUserLogin : EMPLOYEE_EMAIL ,
15251505 currentUserAccountID : EMPLOYEE_ACCOUNT_ID ,
0 commit comments