@@ -68,6 +68,29 @@ describe('TransactionPreviewUtils', () => {
6868 expect ( result . RBRMessage . translationPath ) . toContain ( 'iou.expenseWasPutOnHold' ) ;
6969 } ) ;
7070
71+ it ( 'returns correct receipt error message when the transaction has receipt error' , ( ) => {
72+ const functionArgs = {
73+ ...basicProps ,
74+ transaction : {
75+ ...basicProps . transaction ,
76+ errors : {
77+ error1 : {
78+ error : CONST . IOU . RECEIPT_ERROR ,
79+ source : 'source.com' ,
80+ filename : 'file_name.png' ,
81+ action : 'replaceReceipt' ,
82+ retryParams : { transactionID : basicProps . transaction . transactionID , source : 'source.com' } ,
83+ } ,
84+ } ,
85+ } ,
86+ originalTransaction : undefined ,
87+ shouldShowRBR : true ,
88+ } ;
89+
90+ const result = getTransactionPreviewTextAndTranslationPaths ( functionArgs ) ;
91+ expect ( result . RBRMessage . translationPath ) . toContain ( 'iou.error.receiptFailureMessageShort' ) ;
92+ } ) ;
93+
7194 it ( 'should handle missing iouReport and transaction correctly' , ( ) => {
7295 const functionArgs = { ...basicProps , iouReport : undefined , transaction : undefined , originalTransaction : undefined } ;
7396 const result = getTransactionPreviewTextAndTranslationPaths ( functionArgs ) ;
@@ -208,6 +231,27 @@ describe('TransactionPreviewUtils', () => {
208231 expect ( result . shouldShowRBR ) . toBeTruthy ( ) ;
209232 } ) ;
210233
234+ it ( 'should determine RBR visibility according to whether there is a receipt error' , ( ) => {
235+ const functionArgs = {
236+ ...basicProps ,
237+ transaction : {
238+ ...basicProps . transaction ,
239+ errors : {
240+ error1 : {
241+ error : CONST . IOU . RECEIPT_ERROR ,
242+ source : 'source.com' ,
243+ filename : 'file_name.png' ,
244+ action : 'replaceReceipt' ,
245+ retryParams : { transactionID : basicProps . transaction . transactionID , source : 'source.com' } ,
246+ } ,
247+ } ,
248+ } ,
249+ } ;
250+
251+ const result = createTransactionPreviewConditionals ( functionArgs ) ;
252+ expect ( result . shouldShowRBR ) . toBeTruthy ( ) ;
253+ } ) ;
254+
211255 it ( "should not show category if it's not a policy expense chat" , ( ) => {
212256 const functionArgs = { ...basicProps , isReportAPolicyExpenseChat : false } ;
213257 const result = createTransactionPreviewConditionals ( functionArgs ) ;
0 commit comments