diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 1f7cba67259a..fa799a03ca54 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -4347,7 +4347,7 @@ function createTypeMenuSections(params: TypeMenuSectionsParams): SearchTypeMenuS const insightsSearchKeys = [ CONST.SEARCH.SEARCH_KEYS.SPEND_OVER_TIME, - ...(!isTrackIntentUser ? [CONST.SEARCH.SEARCH_KEYS.TOP_SPENDERS] : []), + CONST.SEARCH.SEARCH_KEYS.TOP_SPENDERS, CONST.SEARCH.SEARCH_KEYS.TOP_CATEGORIES, CONST.SEARCH.SEARCH_KEYS.TOP_MERCHANTS, ]; diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index 17f0af427d5c..82b99666d4b4 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -6999,6 +6999,51 @@ describe('SearchUIUtils', () => { expect(allKeys).not.toContain(CONST.SEARCH.SEARCH_KEYS.EXPORT); }); + it('should show top spenders for track-intent users on eligible paid workspace', () => { + const mockPolicies = { + policy1: { + id: 'policy1', + name: 'Test Policy', + owner: adminEmail, + outputCurrency: 'USD', + isPolicyExpenseChatEnabled: true, + role: CONST.POLICY.ROLE.ADMIN, + type: CONST.POLICY.TYPE.TEAM, + employeeList: { + [adminEmail]: { + email: adminEmail, + role: CONST.POLICY.ROLE.ADMIN, + submitsTo: approverEmail, + }, + [approverEmail]: { + email: approverEmail, + role: CONST.POLICY.ROLE.USER, + submitsTo: adminEmail, + }, + }, + }, + }; + + const sections = SearchUIUtils.createTypeMenuSections({ + currentUserEmail: adminEmail, + currentUserAccountID: adminAccountID, + cardFeedsByPolicy: {}, + defaultCardFeed: undefined, + policies: mockPolicies, + savedSearches: {}, + isOffline: false, + defaultExpensifyCard: undefined, + shouldRedirectToExpensifyClassic: false, + draftTransactionIDs: [], + isTrackIntentUser: true, + }); + + const allMenuItems = sections.flatMap((section) => section.menuItems); + const allKeys = allMenuItems.map((item) => item.key); + + expect(allKeys).toContain(CONST.SEARCH.SEARCH_KEYS.TOP_SPENDERS); + }); + it('should generate correct routes', () => { const menuItems = SearchUIUtils.createTypeMenuSections({ currentUserEmail: undefined,