@@ -175,6 +175,13 @@ describe('TransactionPreviewUtils', () => {
175175 } ) ;
176176
177177 describe ( 'createTransactionPreviewConditionals' , ( ) => {
178+ beforeAll ( ( ) => {
179+ Onyx . merge ( ONYXKEYS . SESSION , { accountID : 999 } ) ;
180+ } ) ;
181+ afterAll ( ( ) => {
182+ Onyx . clear ( [ ONYXKEYS . SESSION ] ) ;
183+ } ) ;
184+
178185 it ( 'should determine RBR visibility according to violation and hold conditions' , ( ) => {
179186 const functionArgs = {
180187 ...basicProps ,
@@ -203,6 +210,15 @@ describe('TransactionPreviewUtils', () => {
203210 transactionDetails : {
204211 amount : 1 ,
205212 } ,
213+ action : {
214+ ...basicProps . action ,
215+ originalMessage : {
216+ participantAccountIDs : [ 999 ] ,
217+ amount : 100 ,
218+ currency : 'USD' ,
219+ type : CONST . REPORT . ACTIONS . TYPE . IOU ,
220+ } ,
221+ } ,
206222 } ;
207223 const result = createTransactionPreviewConditionals ( functionArgs ) ;
208224 expect ( result . shouldShowSplitShare ) . toBeTruthy ( ) ;
@@ -256,6 +272,35 @@ describe('TransactionPreviewUtils', () => {
256272 const result = createTransactionPreviewConditionals ( functionArgs ) ;
257273 expect ( result . shouldShowDescription ) . toBeTruthy ( ) ;
258274 } ) ;
275+
276+ it ( 'should show split share only if user is part of the split bill transaction' , async ( ) => {
277+ const functionArgs = {
278+ ...basicProps ,
279+ isBillSplit : true ,
280+ transactionDetails : { amount : 100 } ,
281+ action : {
282+ ...basicProps . action ,
283+ originalMessage : {
284+ participantAccountIDs : [ 999 ] ,
285+ amount : 100 ,
286+ currency : 'USD' ,
287+ type : CONST . REPORT . ACTIONS . TYPE . IOU ,
288+ } ,
289+ } ,
290+ } ;
291+ const result = createTransactionPreviewConditionals ( functionArgs ) ;
292+ expect ( result . shouldShowSplitShare ) . toBeTruthy ( ) ;
293+ } ) ;
294+
295+ it ( 'should not show split share if user is not a participant' , async ( ) => {
296+ const functionArgs = {
297+ ...basicProps ,
298+ isBillSplit : true ,
299+ transactionDetails : { amount : 100 } ,
300+ } ;
301+ const result = createTransactionPreviewConditionals ( functionArgs ) ;
302+ expect ( result . shouldShowSplitShare ) . toBeFalsy ( ) ;
303+ } ) ;
259304 } ) ;
260305
261306 describe ( 'getViolationTranslatePath' , ( ) => {
0 commit comments