[No QA] Improve test cases and comments in OptionsListUtilsTest.ts#61194
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
| expect(results.recentReports).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'receipts@expensify.com'})])); | ||
| }); | ||
|
|
||
| it('should keep admin rooms if specified', () => { |
There was a problem hiding this comment.
Is there a reason to remove this test case?
There was a problem hiding this comment.
Right, this should not have been removed, I'm bringing it back!
| // When we filter in the Search view without providing a searchValue | ||
| const results = getSearchOptions(OPTIONS, [CONST.BETAS.ALL]); | ||
| describe('getSearchOptions()', () => { | ||
| it('should filter options correctly', () => { |
There was a problem hiding this comment.
| it('should filter options correctly', () => { | |
| it('should return all options when no search value is provided', () => { |
| personalDetails: [], | ||
| reports: [], | ||
| describe('orderOptions()', () => { | ||
| it('should sort all options correctly', () => { |
There was a problem hiding this comment.
| it('should sort all options correctly', () => { | |
| it('should sort options alphabetically and preserves reportID for personal details with existing reports', () => { |
| expect(personalDetailWithExistingReport?.reportID).toBe('2'); | ||
| }); | ||
|
|
||
| it('should sort all options correctly with no reports', () => { |
There was a problem hiding this comment.
| it('should sort all options correctly with no reports', () => { | |
| it('should sort personal details options alphabetically when only personal details are provided', () => { |
| // (minus the currently logged in user) | ||
| // Filtering of personalDetails that have reports is done in filterOptions | ||
| describe('getValidOptions()', () => { | ||
| it('should correctly filter when there are no reports or personalDetails', () => { |
There was a problem hiding this comment.
| it('should correctly filter when there are no reports or personalDetails', () => { | |
| it('should return empty options when no reports or personal details are provided', () => { |
| expect(results.selfDMChat).toEqual(undefined); | ||
| }); | ||
|
|
||
| it('should include Concierge in results', () => { |
There was a problem hiding this comment.
| it('should include Concierge in results', () => { | |
| it('should include Concierge by default in results', () => { |
|
|
||
| // Test by excluding Chronos from the results | ||
| results = getValidOptions({reports: OPTIONS_WITH_CHRONOS.reports, personalDetails: OPTIONS_WITH_CHRONOS.personalDetails}, {excludeLogins: {[CONST.EMAIL.CHRONOS]: true}}); | ||
| it('should exclude Chronos from the results', () => { |
There was a problem hiding this comment.
| it('should exclude Chronos from the results', () => { | |
| it('should exclude Chronos from the results when it is specified in excludedLogins', () => { |
|
|
||
| // Test by excluding Receipts from the results | ||
| results = getValidOptions( | ||
| it('should exclude receipts from the results', () => { |
There was a problem hiding this comment.
| it('should exclude receipts from the results', () => { | |
| it('should exclude Receipts from the results when it is specified in excludedLogins', () => { |
| includeOwnedWorkspaceChats: true, | ||
| }); | ||
| describe('getShareDestinationsOptions()', () => { | ||
| it('should exclude archived rooms and hidden threads', () => { |
There was a problem hiding this comment.
| it('should exclude archived rooms and hidden threads', () => { | |
| it('should exclude archived rooms and hidden threads from share destinations', () => { |
| expect(results.personalDetails).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'receipts@expensify.com'})])); | ||
| expect(results.recentReports).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'receipts@expensify.com'})])); | ||
| }); | ||
| it('should return the DMS, the group chats and the workspace room', () => { |
There was a problem hiding this comment.
| it('should return the DMS, the group chats and the workspace room', () => { | |
| it('should include DMS, group chats, and workspace rooms in share destinations', () => { |
| // When we only pass personal details | ||
| const results = getMemberInviteOptions(OPTIONS.personalDetails, []); | ||
| describe('getMemberInviteOptions()', () => { | ||
| it('should sort personal details', () => { |
There was a problem hiding this comment.
| it('should sort personal details', () => { | |
| it('should sort personal details alphabetically', () => { |
|
@rayane-d changes applied, thanks for reviewing this so thoroughly! |
|
@JKobrynski @puneetlath Could you share the QA steps? |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.1.40-0 🚀
|
|
@kavimuru This should be |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.1.40-7 🚀
|
Explanation of Change
Fixed Issues
$ #60955
PROPOSAL: N/A
Tests
npm run test tests/unit/OptionsListUtilsTest.tsOffline tests
N/A
QA Steps
Same as Tests section above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.MacOS: Desktop