Skip to content

Commit

Permalink
fix: name changes for Updated on -> Updated date (#3486)
Browse files Browse the repository at this point in the history
* fix: name changes for Updated on -> Updated date

* linting fix

---------

Co-authored-by: Amit Pile <[email protected]>
  • Loading branch information
amit429 and Amit Pile authored Feb 6, 2025
1 parent 14730c8 commit ff2aacf
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/app/core/mock-data/filter-pills.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const allFilterPills: FilterPill[] = deepFreeze([
value: '2023-02-20 to 2023-02-22',
},
{
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: '2023-02-22 to 2023-02-24',
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/mock-data/selected-filters.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const selectedFilters1: SelectedFilters<string>[] = deepFreeze([
},
},
{
name: 'Updated On',
name: 'Updated date',
value: 'custom',
associatedData: {
startDate: new Date('2023-02-22T00:00:00.000Z'),
Expand All @@ -35,7 +35,7 @@ export const selectedFilters1: SelectedFilters<string>[] = deepFreeze([

export const selectedFilters2: SelectedFilters<string>[] = deepFreeze([
{
name: 'Updated On',
name: 'Updated date',
value: 'custom',
associatedData: {
startDate: new Date('2023-02-22T00:00:00.000Z'),
Expand Down
8 changes: 4 additions & 4 deletions src/app/core/services/personal-cards.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ describe('PersonalCardsService', () => {
personalCardsService.generateUpdatedOnCustomDatePill(filters, filterPills);
expect(filterPills).toEqual([
{
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: '2023-02-21 to 2023-02-23',
},
Expand All @@ -456,7 +456,7 @@ describe('PersonalCardsService', () => {
personalCardsService.generateUpdatedOnCustomDatePill(filters, filterPills);
expect(filterPills).toEqual([
{
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: '>= 2023-02-21',
},
Expand All @@ -477,7 +477,7 @@ describe('PersonalCardsService', () => {
personalCardsService.generateUpdatedOnCustomDatePill(filters, filterPills);
expect(filterPills).toEqual([
{
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: '<= 2023-02-23',
},
Expand Down Expand Up @@ -601,7 +601,7 @@ describe('PersonalCardsService', () => {
personalCardsService.generateDateFilterPills('updatedOn', filters, filterPills);
expect(filterPills).toEqual([
{
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: '>= 2023-02-21',
},
Expand Down
10 changes: 5 additions & 5 deletions src/app/core/services/personal-cards.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class PersonalCardsService {
}
}

const updatedOnDateFilter = selectedFilters.find((filter) => filter.name === 'Updated On');
const updatedOnDateFilter = selectedFilters.find((filter) => filter.name === 'Updated date');
if (updatedOnDateFilter) {
generatedFilters.updatedOn = { name: updatedOnDateFilter.value };
if (updatedOnDateFilter.associatedData) {
Expand All @@ -280,7 +280,7 @@ export class PersonalCardsService {
if (filter?.updatedOn) {
const dateFilter = filter;
generatedFilters.push({
name: 'Updated On',
name: 'Updated date',
value: dateFilter.updatedOn.name,
associatedData: {
startDate: dateFilter.updatedOn.customDateStart,
Expand Down Expand Up @@ -406,19 +406,19 @@ export class PersonalCardsService {

if (startDate && endDate) {
filterPills.push({
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: `${startDate} to ${endDate}`,
});
} else if (startDate) {
filterPills.push({
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: `>= ${startDate}`,
});
} else if (endDate) {
filterPills.push({
label: 'Updated On',
label: 'Updated date',
type: 'date',
value: `<= ${endDate}`,
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/fyle/personal-cards/personal-cards.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ describe('PersonalCardsPage', () => {
updatedOn: {},
};

component.onFilterClose('Updated On');
component.onFilterClose('Updated date');
expect(component.addNewFiltersToParams).toHaveBeenCalledTimes(1);
expect(personalCardsService.generateFilterPills).toHaveBeenCalledTimes(1);
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/fyle/personal-cards/personal-cards.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ export class PersonalCardsPage implements OnInit, AfterViewInit {
],
} as FilterOptions<DateFilters>,
{
name: 'Updated On',
name: 'Updated date',
optionType: FilterOptionType.date,
options: [
{
Expand Down Expand Up @@ -720,7 +720,7 @@ export class PersonalCardsPage implements OnInit, AfterViewInit {
delete this.filters.createdOn;
}

if (filterLabel === 'Updated On') {
if (filterLabel === 'Updated date') {
delete this.filters.updatedOn;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('FyFiltersComponent', () => {
fixture.detectChanges();
expect(component.currentFilterValueMap).toEqual({
'Created On': 'custom',
'Updated On': 'custom',
'Updated date': 'custom',
'Transactions Type': 'Debit',
Type: 'custom',
'Receipts Attached': 'custom',
Expand Down Expand Up @@ -275,8 +275,8 @@ describe('FyFiltersComponent', () => {

component.ngOnInit();
fixture.detectChanges();
expect(component.startDate).toEqual(undefined);
expect(component.endDate).toEqual(undefined);
expect(component.startDate).toBeUndefined();
expect(component.endDate).toBeUndefined();
});

it('should set filterOptions options to optionsNewFlowCCCOnly', () => {
Expand Down Expand Up @@ -532,20 +532,21 @@ describe('FyFiltersComponent', () => {
fixture.detectChanges();
expect(component.currentFilterValueMap).toEqual({
'Created On': 'custom',
'Updated On': 'custom',
'Updated date': 'custom',
'Transactions Type': 'Debit',
Type: 'custom',
'Receipts Attached': 'custom',
});
expect(component.customDateMap).toEqual({});
expect(component.startDate).toEqual(undefined);
expect(component.endDate).toEqual(undefined);
expect(component.startDate).toBeUndefined();
expect(component.endDate).toBeUndefined();
component.clearAll();
expect(component.currentFilterValueMap).toEqual({});
expect(component.customDateMap).toEqual({});
expect(component.startDate).toBeNull();
expect(component.endDate).toBeNull();
});

it('onDateChange(): should update startDate and endDate', () => {
component.simplifyReportsSettings$ = of({ enabled: false });
component.selectedFilterValues = selectedFilters1;
Expand Down

0 comments on commit ff2aacf

Please sign in to comment.