@@ -616,6 +616,34 @@ describe('OptionsListUtils', () => {
616616 // Then all of the reports should be shown including the archived rooms, except for the thread report with notificationPreferences hidden.
617617 expect ( results . recentReports . length ) . toBe ( Object . values ( OPTIONS . reports ) . length - 1 ) ;
618618 } ) ;
619+
620+ it ( 'should include current user when includeCurrentUser is true for type:chat from suggestions' , ( ) => {
621+ // Given a set of options where the current user is Iron Man (accountID: 2)
622+ // When we call getSearchOptions with includeCurrentUser set to true
623+ const results = getSearchOptions ( OPTIONS , [ CONST . BETAS . ALL ] , true , true , '' , undefined , false , true , true ) ;
624+
625+ // Then the current user should be included in personalDetails
626+ const currentUserOption = results . personalDetails . find ( ( option ) => option . login === 'tonystark@expensify.com' ) ;
627+ expect ( currentUserOption ) . toBeDefined ( ) ;
628+ expect ( currentUserOption ?. text ) . toBe ( 'Iron Man' ) ;
629+ expect ( currentUserOption ?. accountID ) . toBe ( 2 ) ;
630+
631+ // Then all personal details including the current user should be returned
632+ expect ( results . personalDetails . length ) . toBe ( 10 ) ;
633+ } ) ;
634+
635+ it ( 'should exclude current user when includeCurrentUser is false' , ( ) => {
636+ // Given a set of options where the current user is Iron Man (accountID: 2)
637+ // When we call getSearchOptions with includeCurrentUser set to false (default behavior)
638+ const results = getSearchOptions ( OPTIONS , [ CONST . BETAS . ALL ] , true , true , '' , undefined , false , true , false ) ;
639+
640+ // Then the current user should not be included in personalDetails
641+ const currentUserOption = results . personalDetails . find ( ( option ) => option . login === 'tonystark@expensify.com' ) ;
642+ expect ( currentUserOption ) . toBeUndefined ( ) ;
643+
644+ // Then all personal details except the current user should be returned
645+ expect ( results . personalDetails . length ) . toBe ( 9 ) ;
646+ } ) ;
619647 } ) ;
620648
621649 describe ( 'orderOptions()' , ( ) => {
0 commit comments