-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix search invoice page doesn't display merchant text "expense" #53349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2c5aa05
fix search invoice page doesn't display merchant text
NJ-2020 39b5e06
Merge branch 'Expensify:main' into fix/50794
NJ-2020 0bdd085
Merge branch 'Expensify:main' into fix/50794
NJ-2020 bcc73ad
create new unit test file
NJ-2020 1059bef
fix eslint errors
NJ-2020 19aa417
fix eslint errors
NJ-2020 37c3591
Merge branch 'Expensify:main' into fix/50794
NJ-2020 6942bc5
fix eslint and typescript errors
NJ-2020 eaebfdf
fix eslint error
NJ-2020 a3247f3
update SearchUIUtilsTest.ts
NJ-2020 ca6951f
fix esl
NJ-2020 b27b051
update report id comment
NJ-2020 d882e9f
update transaction id comment
NJ-2020 8d40a20
update search results comment
NJ-2020 9d31e21
add comment for transactionSections
NJ-2020 566a525
add comment for describe test function
NJ-2020 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| import type {TransactionListItemType} from '@components/SelectionList/types'; | ||
| import CONST from '@src/CONST'; | ||
| import * as SearchUIUtils from '@src/libs/SearchUIUtils'; | ||
| import type * as OnyxTypes from '@src/types/onyx'; | ||
|
|
||
| const accountID = 18439984; | ||
| const policyID = 'A1B2C3'; | ||
| const reportID = '123456789'; | ||
| const transactionID = '1'; | ||
|
|
||
| // Given search data results consisting of involved users' personal details, policyID, reportID and transactionID | ||
| const searchResults: OnyxTypes.SearchResults = { | ||
| data: { | ||
| personalDetailsList: { | ||
| [accountID]: { | ||
| accountID, | ||
| avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/avatar_3.png', | ||
| displayName: 'test', | ||
| login: 'test1234@gmail.com', | ||
| }, | ||
| }, | ||
| [`policy_${policyID}`]: { | ||
| approvalMode: 'OPTIONAL', | ||
| autoReimbursement: { | ||
| limit: 0, | ||
| }, | ||
| autoReimbursementLimit: 0, | ||
| autoReporting: true, | ||
| autoReportingFrequency: 'instant', | ||
| preventSelfApproval: false, | ||
| owner: 'test1234@gmail.com', | ||
| reimbursementChoice: 'reimburseManual', | ||
| role: 'admin', | ||
| type: 'team', | ||
| }, | ||
| [`report_${reportID}`]: { | ||
| accountID, | ||
| action: 'view', | ||
| chatReportID: '1706144653204915', | ||
| created: '2024-12-21 13:05:20', | ||
| currency: 'USD', | ||
| isOneTransactionReport: true, | ||
| isPolicyExpenseChat: false, | ||
| isWaitingOnBankAccount: false, | ||
| managerID: accountID, | ||
| nonReimbursableTotal: 0, | ||
| ownerAccountID: accountID, | ||
| policyID, | ||
| reportID, | ||
| reportName: 'Expense Report #123', | ||
| stateNum: 1, | ||
| statusNum: 1, | ||
| total: -5000, | ||
| type: 'expense', | ||
| unheldTotal: -5000, | ||
| }, | ||
| [`transactions_${transactionID}`]: { | ||
| accountID, | ||
| action: 'view', | ||
| amount: -5000, | ||
| canDelete: true, | ||
| canHold: true, | ||
| canUnhold: false, | ||
| category: '', | ||
| comment: { | ||
| comment: '', | ||
| }, | ||
| created: '2024-12-21', | ||
| currency: 'USD', | ||
| hasEReceipt: false, | ||
| isFromOneTransactionReport: true, | ||
| managerID: accountID, | ||
| description: '', | ||
| hasViolation: false, | ||
| merchant: 'Expense', | ||
| modifiedAmount: 0, | ||
| modifiedCreated: '', | ||
| modifiedCurrency: '', | ||
| modifiedMerchant: 'Expense', | ||
| parentTransactionID: '', | ||
| policyID, | ||
| reportID, | ||
| reportType: 'expense', | ||
| tag: '', | ||
| transactionID, | ||
| transactionThreadReportID: '456', | ||
| transactionType: 'cash', | ||
| }, | ||
| }, | ||
| search: { | ||
| columnsToShow: { | ||
| shouldShowCategoryColumn: true, | ||
| shouldShowTagColumn: false, | ||
| shouldShowTaxColumn: false, | ||
| }, | ||
| hasMoreResults: false, | ||
| hasResults: true, | ||
| offset: 0, | ||
| status: 'all', | ||
| isLoading: false, | ||
| type: 'expense', | ||
| }, | ||
| }; | ||
|
|
||
| // When the results are filtered by type "expense" to be displayed on the search page | ||
| const transactionSections = SearchUIUtils.getSections('expense', 'all', searchResults.data, searchResults.search) as TransactionListItemType[]; | ||
| const tests = transactionSections.map((transactionList) => [{transactionListItem: transactionList, expectedMerchant: CONST.TRANSACTION.DEFAULT_MERCHANT}]); | ||
|
|
||
NJ-2020 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Then verify the merchant column is displayed as "Expense", and does not contain an empty string | ||
| describe('SearchUIUtils', () => { | ||
| test.each(tests)('Transaction list item with "Expense" merchant', ({transactionListItem, expectedMerchant}) => { | ||
| expect(transactionListItem.merchant).toEqual(expectedMerchant); | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.