Skip to content

Commit 618156c

Browse files
committed
added withdrawal-type tests
1 parent b74921c commit 618156c

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

tests/unit/Search/SearchQueryUtilsTest.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,18 @@ describe('SearchQueryUtils', () => {
189189
expect(result).not.toMatch(CONST.VALIDATE_FOR_HTML_TAG_REGEX);
190190
});
191191

192+
test('with withdrawal type filter', () => {
193+
const filterValues: Partial<SearchAdvancedFiltersForm> = {
194+
type: 'expense',
195+
status: CONST.SEARCH.STATUS.EXPENSE.ALL,
196+
withdrawalType: CONST.SEARCH.WITHDRAWAL_TYPE.EXPENSIFY_CARD,
197+
};
198+
199+
const result = buildQueryStringFromFilterFormValues(filterValues);
200+
201+
expect(result).toEqual('sortBy:date sortOrder:desc type:expense withdrawal-type:expensify-card');
202+
});
203+
192204
test('with withdrawn filter', () => {
193205
const filterValues: Partial<SearchAdvancedFiltersForm> = {
194206
type: 'expense',

tests/unit/SearchParserTest.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,20 @@ const keywordTests = [
588588
},
589589
},
590590
},
591+
{
592+
query: 'type:expense withdrawal-type:expensify-card',
593+
expected: {
594+
type: CONST.SEARCH.DATA_TYPES.EXPENSE,
595+
status: CONST.SEARCH.STATUS.EXPENSE.ALL,
596+
sortBy: CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE,
597+
sortOrder: CONST.SEARCH.SORT_ORDER.DESC,
598+
filters: {
599+
operator: CONST.SEARCH.SYNTAX_OPERATORS.EQUAL_TO,
600+
left: CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE,
601+
right: CONST.SEARCH.WITHDRAWAL_TYPE.EXPENSIFY_CARD,
602+
},
603+
},
604+
},
591605
{
592606
query: 'type:expense withdrawn:last-month',
593607
expected: {

0 commit comments

Comments
 (0)