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