@@ -180,6 +180,13 @@ describe('TransactionPreviewUtils', () => {
180
180
} ) ;
181
181
182
182
describe ( 'createTransactionPreviewConditionals' , ( ) => {
183
+ beforeAll ( ( ) => {
184
+ Onyx . merge ( ONYXKEYS . SESSION , { accountID : 999 } ) ;
185
+ } ) ;
186
+ afterAll ( ( ) => {
187
+ Onyx . clear ( [ ONYXKEYS . SESSION ] ) ;
188
+ } ) ;
189
+
183
190
it ( 'should determine RBR visibility according to violation and hold conditions' , ( ) => {
184
191
const functionArgs = {
185
192
...basicProps ,
@@ -208,6 +215,15 @@ describe('TransactionPreviewUtils', () => {
208
215
transactionDetails : {
209
216
amount : 1 ,
210
217
} ,
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
+ } ,
211
227
} ;
212
228
const result = createTransactionPreviewConditionals ( functionArgs ) ;
213
229
expect ( result . shouldShowSplitShare ) . toBeTruthy ( ) ;
@@ -261,6 +277,35 @@ describe('TransactionPreviewUtils', () => {
261
277
const result = createTransactionPreviewConditionals ( functionArgs ) ;
262
278
expect ( result . shouldShowDescription ) . toBeTruthy ( ) ;
263
279
} ) ;
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
+ } ) ;
264
309
} ) ;
265
310
266
311
describe ( 'getViolationTranslatePath' , ( ) => {
0 commit comments