Skip to content

Commit fa2c1af

Browse files
committed
fix lint and add unit tests
1 parent 3075120 commit fa2c1af

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/pages/Search/AdvancedSearchFilters.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import reportsSelector from '@selectors/Attributes';
21
import {filterCardsHiddenFromSearch} from '@selectors/Card';
32
import React, {useMemo} from 'react';
43
import {View} from 'react-native';
@@ -569,10 +568,12 @@ function AdvancedSearchFilters() {
569568
const styles = useThemeStyles();
570569
const {singleExecution} = useSingleExecution();
571570
const waitForNavigate = useWaitForNavigation();
571+
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
572572
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES, {canBeMissing: true});
573573
const [searchAdvancedFilters = getEmptyObject<SearchAdvancedFiltersForm>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
574574
const [searchCards] = useOnyx(ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST, {canBeMissing: true, selector: filterCardsHiddenFromSearch});
575575
const personalDetails = usePersonalDetails();
576+
const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true});
576577

577578
const [policies = getEmptyObject<NonNullable<OnyxCollection<Policy>>>()] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
578579

tests/unit/CardUtilsTest.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,23 @@ describe('CardUtils', () => {
21382138
const description = getCardDescription(card, translateLocal);
21392139
expect(description).toBe(CONST.EXPENSIFY_CARD.BANK);
21402140
});
2141+
2142+
it('should return the correct card description for personal card', () => {
2143+
const personalCard: Card = {
2144+
accountID: 1,
2145+
bank: CONST.COMPANY_CARD.FEED_BANK_NAME.VISA,
2146+
cardID: 1,
2147+
cardName: 'Personal Visa •••• 1234',
2148+
domainName: '',
2149+
fraud: 'none',
2150+
lastFourPAN: '1234',
2151+
lastScrape: '',
2152+
lastUpdated: '',
2153+
state: 3,
2154+
};
2155+
const description = getCardDescription(personalCard, translateLocal);
2156+
expect(description).toBe('Personal Visa •••• 1234');
2157+
});
21412158
});
21422159

21432160
describe('PersonalCard (isPersonalCard)', () => {

0 commit comments

Comments
 (0)