@@ -180,6 +180,13 @@ describe('TransactionPreviewUtils', () => {
180180 } ) ;
181181
182182 describe ( 'createTransactionPreviewConditionals' , ( ) => {
183+ beforeAll ( ( ) => {
184+ Onyx . merge ( ONYXKEYS . SESSION , { accountID : 999 } ) ;
185+ } ) ;
186+ afterAll ( ( ) => {
187+ Onyx . clear ( [ ONYXKEYS . SESSION ] ) ;
188+ } ) ;
189+
183190 it ( 'should determine RBR visibility according to violation and hold conditions' , ( ) => {
184191 const functionArgs = {
185192 ...basicProps ,
@@ -208,6 +215,15 @@ describe('TransactionPreviewUtils', () => {
208215 transactionDetails : {
209216 amount : 1 ,
210217 } ,
218+ action : {
219+ ...basicProps . action ,
220+ originalMessage : {
221+ participantAccountIDs : [ 999 ] ,
222+ amount : 100 ,
223+ currency : 'USD' ,
224+ type : CONST . REPORT . ACTIONS . TYPE . IOU ,
225+ } ,
226+ } ,
211227 } ;
212228 const result = createTransactionPreviewConditionals ( functionArgs ) ;
213229 expect ( result . shouldShowSplitShare ) . toBeTruthy ( ) ;
@@ -261,6 +277,35 @@ describe('TransactionPreviewUtils', () => {
261277 const result = createTransactionPreviewConditionals ( functionArgs ) ;
262278 expect ( result . shouldShowDescription ) . toBeTruthy ( ) ;
263279 } ) ;
280+
281+ it ( 'should show split share only if user is part of the split bill transaction' , ( ) => {
282+ const functionArgs = {
283+ ...basicProps ,
284+ isBillSplit : true ,
285+ transactionDetails : { amount : 100 } ,
286+ action : {
287+ ...basicProps . action ,
288+ originalMessage : {
289+ participantAccountIDs : [ 999 ] ,
290+ amount : 100 ,
291+ currency : 'USD' ,
292+ type : CONST . REPORT . ACTIONS . TYPE . IOU ,
293+ } ,
294+ } ,
295+ } ;
296+ const result = createTransactionPreviewConditionals ( functionArgs ) ;
297+ expect ( result . shouldShowSplitShare ) . toBeTruthy ( ) ;
298+ } ) ;
299+
300+ it ( 'should not show split share if user is not a participant' , ( ) => {
301+ const functionArgs = {
302+ ...basicProps ,
303+ isBillSplit : true ,
304+ transactionDetails : { amount : 100 } ,
305+ } ;
306+ const result = createTransactionPreviewConditionals ( functionArgs ) ;
307+ expect ( result . shouldShowSplitShare ) . toBeFalsy ( ) ;
308+ } ) ;
264309 } ) ;
265310
266311 describe ( 'getViolationTranslatePath' , ( ) => {
0 commit comments