@@ -25,7 +25,6 @@ import {setOptimisticDataForTransactionThreadPreview} from '@userActions/Search'
2525import CONST from '@src/CONST' ;
2626import IntlStore from '@src/languages/IntlStore' ;
2727import type { CardFeedForDisplay } from '@src/libs/CardFeedUtils' ;
28- import * as SearchQueryUtils from '@src/libs/SearchQueryUtils' ;
2928import * as SearchUIUtils from '@src/libs/SearchUIUtils' ;
3029import ONYXKEYS from '@src/ONYXKEYS' ;
3130import ROUTES from '@src/ROUTES' ;
@@ -49,10 +48,6 @@ jest.mock('@userActions/Search', () => ({
4948 ...jest . requireActual < typeof SearchUtils > ( '@userActions/Search' ) ,
5049 setOptimisticDataForTransactionThreadPreview : jest . fn ( ) ,
5150} ) ) ;
52- jest . mock ( '@src/libs/SearchQueryUtils' , ( ) => ( {
53- ...jest . requireActual < typeof SearchQueryUtils > ( '@src/libs/SearchQueryUtils' ) ,
54- getCurrentSearchQueryJSON : jest . fn ( ) ,
55- } ) ) ;
5651
5752const adminAccountID = 18439984 ;
5853const adminEmail = 'admin@policy.com' ;
@@ -2241,73 +2236,6 @@ describe('SearchUIUtils', () => {
22412236 } ) ;
22422237 } ) ;
22432238
2244- describe ( 'Test getSections with shouldSkipActionFiltering option' , ( ) => {
2245- beforeEach ( ( ) => {
2246- // Mock getCurrentSearchQueryJSON to return a query with action filter
2247- ( SearchQueryUtils . getCurrentSearchQueryJSON as jest . Mock ) . mockReturnValue ( {
2248- type : 'expense-report' ,
2249- filters : {
2250- operator : 'and' ,
2251- left : { operator : 'eq' , left : 'action' , right : 'approve' } ,
2252- } ,
2253- flatFilters : [
2254- {
2255- key : 'action' ,
2256- filters : [ { operator : 'eq' , value : 'approve' } ] ,
2257- } ,
2258- ] ,
2259- } ) ;
2260- } ) ;
2261-
2262- afterEach ( ( ) => {
2263- ( SearchQueryUtils . getCurrentSearchQueryJSON as jest . Mock ) . mockClear ( ) ;
2264- } ) ;
2265-
2266- it ( 'should return all expense reports when shouldSkipActionFiltering is true' , ( ) => {
2267- const result = SearchUIUtils . getSections ( {
2268- type : CONST . SEARCH . DATA_TYPES . EXPENSE_REPORT ,
2269- data : searchResults . data ,
2270- currentAccountID : 2074551 ,
2271- currentUserEmail : '' ,
2272- translate : translateLocal ,
2273- formatPhoneNumber,
2274- bankAccountList : { } ,
2275- shouldSkipActionFiltering : true ,
2276- } ) [ 0 ] as TransactionGroupListItemType [ ] ;
2277-
2278- expect ( result . length ) . toBe ( 4 ) ; // All expense reports returned
2279- } ) ;
2280-
2281- it ( 'should return only filtered expense reports when shouldSkipActionFiltering is false' , ( ) => {
2282- const result = SearchUIUtils . getSections ( {
2283- type : CONST . SEARCH . DATA_TYPES . EXPENSE_REPORT ,
2284- data : searchResults . data ,
2285- currentAccountID : 2074551 ,
2286- currentUserEmail : '' ,
2287- translate : translateLocal ,
2288- formatPhoneNumber,
2289- bankAccountList : { } ,
2290- shouldSkipActionFiltering : false ,
2291- } ) [ 0 ] as TransactionGroupListItemType [ ] ;
2292-
2293- expect ( result . length ) . toBe ( 2 ) ; // Only filtered expense reports returned
2294- } ) ;
2295-
2296- it ( 'should apply default filtering behavior when shouldSkipActionFiltering is undefined' , ( ) => {
2297- const result = SearchUIUtils . getSections ( {
2298- type : CONST . SEARCH . DATA_TYPES . EXPENSE_REPORT ,
2299- data : searchResults . data ,
2300- currentAccountID : 2074551 ,
2301- currentUserEmail : '' ,
2302- translate : translateLocal ,
2303- formatPhoneNumber,
2304- bankAccountList : { } ,
2305- } ) [ 0 ] as TransactionGroupListItemType [ ] ;
2306-
2307- expect ( result . length ) . toBe ( 2 ) ; // Default behavior applies filtering
2308- } ) ;
2309- } ) ;
2310-
23112239 describe ( 'Test getSortedSections' , ( ) => {
23122240 it ( 'should return getSortedReportActionData result when type is CHAT' , ( ) => {
23132241 const sortedActions = SearchUIUtils . getSortedSections (
0 commit comments