Skip to content
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

feat: added deepFreeze to not pollute global mock data - Part 11 #2927

Merged
merged 3 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions src/app/core/mock-data/selected-filters.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { SelectedFilters } from 'src/app/shared/components/fy-filters/selected-filters.interface';

export const selectedFilters1: SelectedFilters<string>[] = [
export const selectedFilters1: SelectedFilters<string>[] = deepFreeze([
{
name: 'Created On',
value: 'custom',
Expand Down Expand Up @@ -29,9 +31,9 @@ export const selectedFilters1: SelectedFilters<string>[] = [
name: 'Receipts Attached',
value: 'custom',
},
];
]);

export const selectedFilters2: SelectedFilters<string>[] = [
export const selectedFilters2: SelectedFilters<string>[] = deepFreeze([
{
name: 'Updated On',
value: 'custom',
Expand All @@ -52,33 +54,33 @@ export const selectedFilters2: SelectedFilters<string>[] = [
name: 'Transactions Type',
value: 'Debit',
},
];
]);

export const selectedFilters3 = [
export const selectedFilters3 = deepFreeze([
{ name: 'State', value: 'Approved' },
{
name: 'Date',
value: 'Last 7 Days',
associatedData: { startDate: new Date('2023-04-01'), endDate: new Date('2023-04-04') },
},
{ name: 'Sort By', value: 'dateNewToOld' },
];
]);

export const selectedFilters4 = [
export const selectedFilters4 = deepFreeze([
{ name: 'State', value: 'Approved' },
{ name: 'Date', value: 'Last 7 Days', associatedData: undefined },
{ name: 'Sort By', value: 'dateNewToOld' },
];
]);

export const selectedFilters5 = [
export const selectedFilters5 = deepFreeze([
{
name: 'Date',
value: 'Last Month',
associatedData: { startDate: new Date('2023-01-04'), endDate: new Date('2023-01-10') },
},
];
]);

export const taskSelectedFiltersData: SelectedFilters<string[]>[] = [
export const taskSelectedFiltersData: SelectedFilters<string[]>[] = deepFreeze([
{
name: 'Expenses',
value: ['DRAFT'],
Expand All @@ -91,9 +93,9 @@ export const taskSelectedFiltersData: SelectedFilters<string[]>[] = [
name: 'Advances',
value: ['SENT_BACK'],
},
];
]);

export const selectedFilters6: SelectedFilters<string | string[]>[] = [
export const selectedFilters6: SelectedFilters<string | string[]>[] = deepFreeze([
{
name: 'State',
value: 'DRAFT',
Expand All @@ -106,14 +108,14 @@ export const selectedFilters6: SelectedFilters<string | string[]>[] = [
endDate: new Date('2023-02-02'),
},
},
];
]);

export const selectedFiltersParams: SelectedFilters<string> = {
export const selectedFiltersParams: SelectedFilters<string> = deepFreeze({
name: 'Sort By',
value: 'dateNewToOld',
};
});

export const selectedFiltersParams2: SelectedFilters<string>[] = [
export const selectedFiltersParams2: SelectedFilters<string>[] = deepFreeze([
{
name: 'State',
value: 'DRAFT',
Expand All @@ -131,9 +133,9 @@ export const selectedFiltersParams2: SelectedFilters<string>[] = [
endDate: new Date('2023-02-02'),
},
},
];
]);

export const selectedFilters7: SelectedFilters<string | string[]>[] = [
export const selectedFilters7: SelectedFilters<string | string[]>[] = deepFreeze([
...selectedFilters5,
{
name: 'Type',
Expand All @@ -156,9 +158,9 @@ export const selectedFilters7: SelectedFilters<string | string[]>[] = [
name: 'Split Expense',
value: 'Yes',
},
];
]);

export const selectedFilters8: SelectedFilters<string | string[]>[] = [
export const selectedFilters8: SelectedFilters<string | string[]>[] = deepFreeze([
{
name: 'Date',
value: 'Last Month',
Expand All @@ -184,9 +186,9 @@ export const selectedFilters8: SelectedFilters<string | string[]>[] = [
name: 'Split Expense',
value: 'Yes',
},
];
]);

export const selectedFilters9: SelectedFilters<string | string[]>[] = [
export const selectedFilters9: SelectedFilters<string | string[]>[] = deepFreeze([
{
name: 'Type',
value: ['DRAFT', 'READY_TO_REPORT'],
Expand Down Expand Up @@ -215,4 +217,4 @@ export const selectedFilters9: SelectedFilters<string | string[]>[] = [
name: 'Split Expense',
value: 'YES',
},
];
]);
6 changes: 4 additions & 2 deletions src/app/core/mock-data/sidemenu-allowed-actions.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { SidemenuAllowedActions } from '../models/sidemenu-allowed-actions.model';

export const sidemenuAllowedActions: SidemenuAllowedActions = {
export const sidemenuAllowedActions: SidemenuAllowedActions = deepFreeze({
allowedReportsActions: {
allowedRouteAccess: true,
approve: true,
Expand All @@ -12,4 +14,4 @@ export const sidemenuAllowedActions: SidemenuAllowedActions = {
approve: true,
delete: true,
},
};
});
18 changes: 10 additions & 8 deletions src/app/core/mock-data/sidemenu-item.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { SidemenuItem } from '../models/sidemenu-item.model';

export const sidemenuItemData1: SidemenuItem = {
export const sidemenuItemData1: SidemenuItem = deepFreeze({
title: 'Dashboard',
isVisible: true,
icon: 'dashboard',
Expand All @@ -9,9 +11,9 @@ export const sidemenuItemData1: SidemenuItem = {
isDropdownOpen: false,
dropdownOptions: [],
openLiveChat: false,
};
});

export const sidemenuItemData2: SidemenuItem = {
export const sidemenuItemData2: SidemenuItem = deepFreeze({
title: 'Team',
isVisible: true,
icon: 'user-three',
Expand All @@ -31,17 +33,17 @@ export const sidemenuItemData2: SidemenuItem = {
],
route: [],
openLiveChat: false,
};
});

export const sidemenuItemData3: Partial<SidemenuItem> = {
export const sidemenuItemData3: Partial<SidemenuItem> = deepFreeze({
title: 'Live Chat',
isVisible: true,
icon: 'chat',
openLiveChat: true,
disabled: false,
};
});

export const sidemenuItemData4: Partial<SidemenuItem> = {
export const sidemenuItemData4: Partial<SidemenuItem> = deepFreeze({
title: 'Switch Organization',
isVisible: true,
icon: 'swap',
Expand All @@ -55,4 +57,4 @@ export const sidemenuItemData4: Partial<SidemenuItem> = {
},
],
disabled: false,
};
});
30 changes: 16 additions & 14 deletions src/app/core/mock-data/sidemenu.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { SidemenuItem } from '../models/sidemenu-item.model';

export const sidemenuData1 = [
export const sidemenuData1 = deepFreeze([
{
title: 'Dashboard',
isVisible: true,
Expand All @@ -19,9 +21,9 @@ export const sidemenuData1 = [
icon: 'gear',
route: ['/', 'enterprise', 'my_profile'],
},
];
]);

export const PrimaryOptionsRes1: Partial<SidemenuItem>[] = [
export const PrimaryOptionsRes1: Partial<SidemenuItem>[] = deepFreeze([
{
title: 'Dashboard',
isVisible: true,
Expand Down Expand Up @@ -55,17 +57,17 @@ export const PrimaryOptionsRes1: Partial<SidemenuItem>[] = [
route: ['/', 'enterprise', 'my_advances'],
disabled: false,
},
];
]);

export const UpdatedOptionsRes: Partial<SidemenuItem> = {
export const UpdatedOptionsRes: Partial<SidemenuItem> = deepFreeze({
title: 'Personal Cards',
isVisible: true,
route: ['/', 'enterprise', 'personal_cards'],
icon: 'card',
disabled: false,
};
});

export const PrimaryOptionsRes2: Partial<SidemenuItem>[] = [
export const PrimaryOptionsRes2: Partial<SidemenuItem>[] = deepFreeze([
{
title: 'Team',
isVisible: true,
Expand All @@ -85,9 +87,9 @@ export const PrimaryOptionsRes2: Partial<SidemenuItem>[] = [
},
],
},
];
]);

export const getPrimarySidemenuOptionsRes1 = [
export const getPrimarySidemenuOptionsRes1 = deepFreeze([
{
title: 'Dashboard',
isVisible: true,
Expand Down Expand Up @@ -122,9 +124,9 @@ export const getPrimarySidemenuOptionsRes1 = [
icon: 'user-three',
disabled: false,
},
];
]);

export const getSecondarySidemenuOptionsRes1 = [
export const getSecondarySidemenuOptionsRes1 = deepFreeze([
{
title: 'Delegated Accounts',
isVisible: true,
Expand Down Expand Up @@ -152,9 +154,9 @@ export const getSecondarySidemenuOptionsRes1 = [
route: ['/', 'enterprise', 'help'],
disabled: false,
},
];
]);

export const setSideMenuRes: Partial<SidemenuItem>[] = [
export const setSideMenuRes: Partial<SidemenuItem>[] = deepFreeze([
{
title: 'Dashboard',
isVisible: true,
Expand Down Expand Up @@ -215,4 +217,4 @@ export const setSideMenuRes: Partial<SidemenuItem>[] = [
route: ['/', 'enterprise', 'help'],
disabled: false,
},
];
]);
34 changes: 18 additions & 16 deletions src/app/core/mock-data/snackbar-properties.data.ts
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
import deepFreeze from 'deep-freeze-strict';

import { SnackbarProperties } from '../models/snackbar-properties.model';

export const snackbarPropertiesRes = {
export const snackbarPropertiesRes = deepFreeze({
data: {
icon: 'warning-fill',
showCloseButton: true,
message: 'Please select one or more expenses to be reported',
},
duration: 3000,
};
});

export const snackbarPropertiesRes2 = {
export const snackbarPropertiesRes2 = deepFreeze({
data: {
icon: 'success',
showCloseButton: true,
message: 'Expense added to report successfully',
},
duration: 3000,
};
});

export const snackbarPropertiesRes3 = {
export const snackbarPropertiesRes3 = deepFreeze({
data: {
icon: 'success',
showCloseButton: true,
message: '1 expense has been deleted',
},
duration: 3000,
};
});

export const snackbarPropertiesRes4 = {
export const snackbarPropertiesRes4 = deepFreeze({
data: {
icon: 'warning-fill',
showCloseButton: true,
message: 'We could not delete the expenses. Please try again',
},
duration: 3000,
};
});

export const snackbarPropertiesRes5 = {
export const snackbarPropertiesRes5 = deepFreeze({
data: {
icon: 'success',
showCloseButton: true,
message: 'Expenses merged Successfully',
},
duration: 3000,
};
});

export const snackbarPropertiesRes6: SnackbarProperties = {
export const snackbarPropertiesRes6: SnackbarProperties = deepFreeze({
data: {
icon: 'success',
showCloseButton: true,
message: '1 Transaction successfully hidden!',
},
duration: 3000,
};
});

export const snackbarPropertiesRes7: SnackbarProperties = {
export const snackbarPropertiesRes7: SnackbarProperties = deepFreeze({
data: {
icon: 'success',
showCloseButton: true,
message: '2 Transactions successfully hidden!',
},
duration: 3000,
};
});

export const dismissExpenseSnackbarProps: SnackbarProperties = {
export const dismissExpenseSnackbarProps: SnackbarProperties = deepFreeze({
data: {
icon: 'success',
showCloseButton: true,
message: 'Expense dismissed',
},
duration: 3000,
};
});
Loading
Loading