@@ -8,6 +8,7 @@ import type {
88 TransactionListItemType ,
99 TransactionMemberGroupListItemType ,
1010 TransactionReportGroupListItemType ,
11+ TransactionWithdrawalIDGroupListItemType ,
1112} from '@components/SelectionList/types' ;
1213import * as Expensicons from '@src/components/Icon/Expensicons' ;
1314import CONST from '@src/CONST' ;
@@ -41,6 +42,10 @@ const transactionID3 = '3';
4142const transactionID4 = '4' ;
4243const cardID = 20202020 ;
4344const cardID2 = 30303030 ;
45+ const entryID = 5 ;
46+ const entryID2 = 6 ;
47+ const accountNumber = 'XXXXXXXX6789' ;
48+ const accountNumber2 = 'XXXXXXXX5544' ;
4449
4550const report1 = {
4651 accountID : adminAccountID ,
@@ -551,6 +556,46 @@ const searchResultsGroupByCard: OnyxTypes.SearchResults = {
551556 } ,
552557} ;
553558
559+ const searchResultsGroupByWithdrawalID : OnyxTypes . SearchResults = {
560+ data : {
561+ personalDetailsList : { } ,
562+ [ `${ CONST . SEARCH . GROUP_PREFIX } ${ entryID } ` as const ] : {
563+ entryID,
564+ accountNumber,
565+ bankName : CONST . BANK_NAMES . CHASE ,
566+ debitPosted : '2025-08-12 17:11:22' ,
567+ count : 4 ,
568+ currency : 'USD' ,
569+ total : 40 ,
570+ } ,
571+ [ `${ CONST . SEARCH . GROUP_PREFIX } ${ cardID2 } ` as const ] : {
572+ entryID : entryID2 ,
573+ accountNumber : accountNumber2 ,
574+ bankName : CONST . BANK_NAMES . CITIBANK ,
575+ debitPosted : '2025-08-19 18:10:54' ,
576+ count : 6 ,
577+ currency : 'USD' ,
578+ total : 20 ,
579+ } ,
580+ } ,
581+ search : {
582+ columnsToShow : {
583+ shouldShowCategoryColumn : false ,
584+ shouldShowTagColumn : false ,
585+ shouldShowTaxColumn : false ,
586+ } ,
587+ count : 10 ,
588+ currency : 'USD' ,
589+ hasMoreResults : false ,
590+ hasResults : true ,
591+ offset : 0 ,
592+ status : CONST . SEARCH . STATUS . EXPENSE . ALL ,
593+ total : 60 ,
594+ isLoading : false ,
595+ type : 'expense' ,
596+ } ,
597+ } ;
598+
554599const reportActionListItems = [
555600 {
556601 accountID : 18439984 ,
@@ -1257,6 +1302,56 @@ const transactionCardGroupListItemsSorted: TransactionCardGroupListItemType[] =
12571302 } ,
12581303] ;
12591304
1305+ const transactionWithdrawalIDGroupListItems : TransactionWithdrawalIDGroupListItemType [ ] = [
1306+ {
1307+ bankName : CONST . BANK_NAMES . CHASE ,
1308+ entryID,
1309+ accountNumber,
1310+ debitPosted : '2025-08-12 17:11:22' ,
1311+ count : 4 ,
1312+ currency : 'USD' ,
1313+ total : 40 ,
1314+ groupedBy : 'withdrawal-id' ,
1315+ transactions : [ ] ,
1316+ } ,
1317+ {
1318+ bankName : CONST . BANK_NAMES . CITIBANK ,
1319+ entryID : entryID2 ,
1320+ accountNumber : accountNumber2 ,
1321+ debitPosted : '2025-08-19 18:10:54' ,
1322+ count : 6 ,
1323+ currency : 'USD' ,
1324+ total : 20 ,
1325+ groupedBy : 'withdrawal-id' ,
1326+ transactions : [ ] ,
1327+ } ,
1328+ ] ;
1329+
1330+ const transactionWithdrawalIDGroupListItemsSorted : TransactionWithdrawalIDGroupListItemType [ ] = [
1331+ {
1332+ bankName : CONST . BANK_NAMES . CITIBANK ,
1333+ entryID : entryID2 ,
1334+ accountNumber : accountNumber2 ,
1335+ debitPosted : '2025-08-19 18:10:54' ,
1336+ count : 6 ,
1337+ currency : 'USD' ,
1338+ total : 20 ,
1339+ groupedBy : 'withdrawal-id' ,
1340+ transactions : [ ] ,
1341+ } ,
1342+ {
1343+ bankName : CONST . BANK_NAMES . CHASE ,
1344+ entryID,
1345+ accountNumber,
1346+ debitPosted : '2025-08-12 17:11:22' ,
1347+ count : 4 ,
1348+ currency : 'USD' ,
1349+ total : 40 ,
1350+ groupedBy : 'withdrawal-id' ,
1351+ transactions : [ ] ,
1352+ } ,
1353+ ] ;
1354+
12601355describe ( 'SearchUIUtils' , ( ) => {
12611356 beforeAll ( async ( ) => {
12621357 Onyx . init ( {
@@ -1577,6 +1672,19 @@ describe('SearchUIUtils', () => {
15771672 ) ,
15781673 ) . toStrictEqual ( transactionCardGroupListItems ) ;
15791674 } ) ;
1675+
1676+ it ( 'should return getWithdrawalIDSections result when type is EXPENSE and groupBy is withdrawal-id' , ( ) => {
1677+ expect (
1678+ SearchUIUtils . getSections (
1679+ CONST . SEARCH . DATA_TYPES . EXPENSE ,
1680+ searchResultsGroupByWithdrawalID . data ,
1681+ searchResultsGroupByWithdrawalID . search ,
1682+ 2074551 ,
1683+ formatPhoneNumber ,
1684+ CONST . SEARCH . GROUP_BY . WITHDRAWAL_ID ,
1685+ ) ,
1686+ ) . toStrictEqual ( transactionWithdrawalIDGroupListItems ) ;
1687+ } ) ;
15801688 } ) ;
15811689
15821690 describe ( 'Test getSortedSections' , ( ) => {
@@ -1648,6 +1756,20 @@ describe('SearchUIUtils', () => {
16481756 SearchUIUtils . getSortedSections ( CONST . SEARCH . DATA_TYPES . EXPENSE , '' , transactionCardGroupListItems , localeCompare , 'date' , 'asc' , CONST . SEARCH . GROUP_BY . CARD ) ,
16491757 ) . toStrictEqual ( transactionCardGroupListItemsSorted ) ;
16501758 } ) ;
1759+
1760+ it ( 'should return getSortedWithdrawalIDData result when type is EXPENSE and groupBy is withdrawal-id' , ( ) => {
1761+ expect (
1762+ SearchUIUtils . getSortedSections (
1763+ CONST . SEARCH . DATA_TYPES . EXPENSE ,
1764+ '' ,
1765+ transactionWithdrawalIDGroupListItems ,
1766+ localeCompare ,
1767+ 'date' ,
1768+ 'asc' ,
1769+ CONST . SEARCH . GROUP_BY . WITHDRAWAL_ID ,
1770+ ) ,
1771+ ) . toStrictEqual ( transactionWithdrawalIDGroupListItemsSorted ) ;
1772+ } ) ;
16511773 } ) ;
16521774
16531775 describe ( 'Test createTypeMenuItems' , ( ) => {
0 commit comments