Skip to content

Commit

Permalink
test: 38% coverage of my-expenses service (#2486)
Browse files Browse the repository at this point in the history
* test: my-expenses service test

* major

* test: 75% coverage of my-expense service (#2489)

* test: 75% coverage of my-expense service

* test: 100% coverage of my-expenses service (#2490)

* test: 100% coverage of my-expenses service

* minor
  • Loading branch information
suyashpatil78 authored Oct 9, 2023
1 parent 5357414 commit 57802db
Show file tree
Hide file tree
Showing 6 changed files with 831 additions and 18 deletions.
31 changes: 31 additions & 0 deletions src/app/core/mock-data/expense-filters.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,34 @@ export const expenseFiltersData2: Partial<ExpenseFilters> = {
sortDir: 'asc',
splitExpense: 'YES',
};

export const expenseFiltersData3: Partial<ExpenseFilters> = {
state: 'custom',
date: 'Last Month',
customDateStart: new Date('2023-01-04'),
customDateEnd: new Date('2023-01-10'),
receiptsAttached: 'Yes',
type: ['Mileage'],
cardNumbers: ['1234', '2389'],
splitExpense: 'Yes',
};

export const expenseFiltersData4: Partial<ExpenseFilters> = {
...expenseFiltersData3,
customDateStart: undefined,
customDateEnd: undefined,
};

export const expenseFiltersData5: Partial<ExpenseFilters> = {
receiptsAttached: 'YES',
sortParam: 'tx_amount',
sortDir: 'desc',
splitExpense: 'YES',
};

export const expenseFiltersData6: Partial<ExpenseFilters> = {
receiptsAttached: 'YES',
sortParam: 'tx_txn_dt',
sortDir: 'asc',
splitExpense: 'YES',
};
128 changes: 128 additions & 0 deletions src/app/core/mock-data/filter-options.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FilterOptionType } from 'src/app/shared/components/fy-filters/filter-op
import { FilterOptions } from 'src/app/shared/components/fy-filters/filter-options.interface';
import { AdvancesStates } from '../models/advances-states.model';
import { SortingValue } from '../models/sorting-value.model';
import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum';

export const filterOptions: FilterOptions<string>[] = [
{
Expand Down Expand Up @@ -50,3 +51,130 @@ export const filterOptions: FilterOptions<string>[] = [
],
},
];

export const filterOptions2: FilterOptions<string>[] = [
{
name: 'Type',
optionType: FilterOptionType.multiselect,
options: [
{
label: 'Complete',
value: 'READY_TO_REPORT',
},
{
label: 'Policy Violated',
value: 'POLICY_VIOLATED',
},
{
label: 'Cannot Report',
value: 'CANNOT_REPORT',
},
{
label: 'Incomplete',
value: 'DRAFT',
},
],
},
{
name: 'Date',
optionType: FilterOptionType.date,
options: [
{
label: 'All',
value: DateFilters.all,
},
{
label: 'This Week',
value: DateFilters.thisWeek,
},
{
label: 'This Month',
value: DateFilters.thisMonth,
},
{
label: 'Last Month',
value: DateFilters.lastMonth,
},
{
label: 'Custom',
value: DateFilters.custom,
},
],
},
{
name: 'Receipts Attached',
optionType: FilterOptionType.singleselect,
options: [
{
label: 'Yes',
value: 'YES',
},
{
label: 'No',
value: 'NO',
},
],
},
{
name: 'Expense Type',
optionType: FilterOptionType.multiselect,
options: [
{
label: 'Mileage',
value: 'Mileage',
},
{
label: 'Per Diem',
value: 'PerDiem',
},
{
label: 'Regular Expenses',
value: 'RegularExpenses',
},
],
},
{
name: 'Sort By',
optionType: FilterOptionType.singleselect,
options: [
{
label: 'Date - New to Old',
value: 'dateNewToOld',
},
{
label: 'Date - Old to New',
value: 'dateOldToNew',
},
{
label: 'Amount - High to Low',
value: 'amountHighToLow',
},
{
label: 'Amount - Low to High',
value: 'amountLowToHigh',
},
{
label: 'Category - A to Z',
value: 'categoryAToZ',
},
{
label: 'Category - Z to A',
value: 'categoryZToA',
},
],
},
{
name: 'Split Expense',
optionType: FilterOptionType.singleselect,
options: [
{
label: 'Yes',
value: 'YES',
},
{
label: 'No',
value: 'NO',
},
],
},
];
46 changes: 46 additions & 0 deletions src/app/core/mock-data/filter-pills.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,49 @@ export const filterTypeMappings: FilterPill[] = [
sortFilterPill,
splitExpenseFilterPill,
];

export const sortByDescFilterPill: FilterPill[] = [
{
label: 'Sort By',
type: 'sort',
value: 'amount - high to low',
},
];

export const sortByAscFilterPill: FilterPill[] = [
{
label: 'Sort By',
type: 'sort',
value: 'amount - low to high',
},
];

export const sortByDateAscFilterPill: FilterPill[] = [
{
label: 'Sort By',
type: 'sort',
value: 'date - old to new',
},
];

export const sortByDateDescFilterPill: FilterPill[] = [
{
label: 'Sort By',
type: 'sort',
value: 'date - new to old',
},
];

export const expectedDateFilterPill = [
{
label: 'Date',
type: 'date',
value: '2023-01-21 to 2023-01-31',
},
];

export const stateFilterPill2: FilterPill = {
label: 'Type',
type: 'state',
value: 'Incomplete, Complete, approved',
};
84 changes: 84 additions & 0 deletions src/app/core/mock-data/selected-filters.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,87 @@ export const selectedFiltersParams2: SelectedFilters<string>[] = [
},
},
];

export const selectedFilters7: SelectedFilters<string | string[]>[] = [
...selectedFilters5,
{
name: 'Type',
value: 'custom',
},
{
name: 'Receipts Attached',
value: 'Yes',
},
{
name: 'Expense Type',
value: ['Mileage'],
},
{
name: 'Cards',
value: ['1234', '2389'],
},
{ name: 'Sort By', value: 'dateNewToOld' },
{
name: 'Split Expense',
value: 'Yes',
},
];

export const selectedFilters8: SelectedFilters<string | string[]>[] = [
{
name: 'Date',
value: 'Last Month',
},
{
name: 'Type',
value: 'custom',
},
{
name: 'Receipts Attached',
value: 'Yes',
},
{
name: 'Expense Type',
value: ['Mileage'],
},
{
name: 'Cards',
value: ['1234', '2389'],
},
{ name: 'Sort By', value: 'dateNewToOld' },
{
name: 'Split Expense',
value: 'Yes',
},
];

export const selectedFilters9: SelectedFilters<string | string[]>[] = [
{
name: 'Type',
value: ['DRAFT', 'READY_TO_REPORT'],
},
{
name: 'Receipts Attached',
value: 'YES',
},
{
name: 'Date',
value: 'thisWeek',
associatedData: {
startDate: undefined,
endDate: undefined,
},
},
{
name: 'Expense Type',
value: ['PerDiem', 'Mileage'],
},
{
name: 'Cards',
value: ['1234', '5678'],
},
{
name: 'Split Expense',
value: 'YES',
},
];
Loading

0 comments on commit 57802db

Please sign in to comment.