From b1263a0e64444f6189078587f4531fd759b9e3f4 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 26 Jan 2026 11:56:11 +0700 Subject: [PATCH 1/3] update getMemberInviteOptions to pass undefined to getValidOptions instead of allPolicies --- src/libs/OptionsListUtils/index.ts | 2 +- tests/unit/OptionsListUtilsTest.tsx | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils/index.ts b/src/libs/OptionsListUtils/index.ts index 97d786d0a4f4..a1474dda8a95 100644 --- a/src/libs/OptionsListUtils/index.ts +++ b/src/libs/OptionsListUtils/index.ts @@ -2532,7 +2532,7 @@ function getMemberInviteOptions( ): Options { return getValidOptions( {personalDetails, reports: []}, - allPolicies, + undefined, undefined, nvpDismissedProductTraining, loginList, diff --git a/tests/unit/OptionsListUtilsTest.tsx b/tests/unit/OptionsListUtilsTest.tsx index e4cf1dd43718..ed714c9a7dde 100644 --- a/tests/unit/OptionsListUtilsTest.tsx +++ b/tests/unit/OptionsListUtilsTest.tsx @@ -1427,6 +1427,31 @@ describe('OptionsListUtils', () => { expect(results.personalDetails.at(2)?.text).toBe('Captain America'); expect(results.personalDetails.at(3)?.text).toBe('Invisible Woman'); }); + + it('should return personal details with expected structure', () => { + // Given a set of personalDetails + // When we call getMemberInviteOptions + const results = getMemberInviteOptions(OPTIONS.personalDetails, nvpDismissedProductTraining, loginList, [CONST.BETAS.ALL]); + + // Then personal details should be returned + expect(results.personalDetails.length).toBeGreaterThan(0); + + // Then the results should contain expected structure + expect(results.recentReports).toEqual([]); + expect(results.currentUserOption).toBeUndefined(); + }); + + it('should exclude logins when excludeLogins is provided', () => { + // Given a set of personalDetails and excludeLogins + const excludeLogins = {'reedrichards@expensify.com': true}; + + // When we call getMemberInviteOptions with excludeLogins + const results = getMemberInviteOptions(OPTIONS.personalDetails, nvpDismissedProductTraining, loginList, [], excludeLogins); + + // Then the excluded login should not be in the results + const excludedUser = results.personalDetails.find((detail) => detail.login === 'reedrichards@expensify.com'); + expect(excludedUser).toBeUndefined(); + }); }); describe('getLastActorDisplayName()', () => { From ff429cd21c534d6ef1c4de47ed1c5929e00fa7c4 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 28 Jan 2026 11:17:27 +0700 Subject: [PATCH 2/3] update test --- tests/unit/OptionsListUtilsTest.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/unit/OptionsListUtilsTest.tsx b/tests/unit/OptionsListUtilsTest.tsx index ed714c9a7dde..5661030c27ae 100644 --- a/tests/unit/OptionsListUtilsTest.tsx +++ b/tests/unit/OptionsListUtilsTest.tsx @@ -1416,7 +1416,7 @@ describe('OptionsListUtils', () => { }); describe('getMemberInviteOptions()', () => { - it('should sort personal details alphabetically', () => { + it('should sort personal details alphabetically and return expected structure', () => { // Given a set of personalDetails // When we call getMemberInviteOptions const results = getMemberInviteOptions(OPTIONS.personalDetails, nvpDismissedProductTraining, loginList, []); @@ -1426,17 +1426,9 @@ describe('OptionsListUtils', () => { expect(results.personalDetails.at(1)?.text).toBe('Black Widow'); expect(results.personalDetails.at(2)?.text).toBe('Captain America'); expect(results.personalDetails.at(3)?.text).toBe('Invisible Woman'); - }); - - it('should return personal details with expected structure', () => { - // Given a set of personalDetails - // When we call getMemberInviteOptions - const results = getMemberInviteOptions(OPTIONS.personalDetails, nvpDismissedProductTraining, loginList, [CONST.BETAS.ALL]); - - // Then personal details should be returned - expect(results.personalDetails.length).toBeGreaterThan(0); // Then the results should contain expected structure + expect(results.personalDetails.length).toBeGreaterThan(0); expect(results.recentReports).toEqual([]); expect(results.currentUserOption).toBeUndefined(); }); From bd9d7eaa57d24ab09d5223c481e53210eb86ac6c Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 28 Jan 2026 12:23:54 +0700 Subject: [PATCH 3/3] update test --- tests/unit/OptionsListUtilsTest.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/OptionsListUtilsTest.tsx b/tests/unit/OptionsListUtilsTest.tsx index 9020724275b1..54fa043dc6fa 100644 --- a/tests/unit/OptionsListUtilsTest.tsx +++ b/tests/unit/OptionsListUtilsTest.tsx @@ -1614,7 +1614,7 @@ describe('OptionsListUtils', () => { const excludeLogins = {'reedrichards@expensify.com': true}; // When we call getMemberInviteOptions with excludeLogins - const results = getMemberInviteOptions(OPTIONS.personalDetails, nvpDismissedProductTraining, loginList, [], excludeLogins); + const results = getMemberInviteOptions(OPTIONS.personalDetails, nvpDismissedProductTraining, loginList, CURRENT_USER_ACCOUNT_ID, CURRENT_USER_EMAIL, [], excludeLogins); // Then the excluded login should not be in the results const excludedUser = results.personalDetails.find((detail) => detail.login === 'reedrichards@expensify.com');