Skip to content

Commit

Permalink
feat: added deepFreeze to not pollute global mock data (#2913)
Browse files Browse the repository at this point in the history
* feat: added deepFreeze to not pollute global mock data

* feat: added deepFreeze to not pollute global mock data - Part 2 (#2914)

* feat: added deepFreeze to not pollute global mock data - Part 2

* feat: added deepFreeze to not pollute global mock data - Part 3 (#2915)

* feat: added deepFreeze to not pollute global mock data - Part 3

* feat: added deepFreeze to not pollute global mock data - Part 4 (#2916)

* feat: added deepFreeze to not pollute global mock data - Part 4

* feat: added deepFreeze to not pollute global mock data - Part 5 (#2917)

* feat: added deepFreeze to not pollute global mock data - Part 5

* feat: added deepFreeze to not pollute global mock data - Part 6 (#2918)

* feat: added deepFreeze to not pollute global mock data - Part 6

* feat: added deepFreeze to not pollute global mock data - Part 7 (#2919)

* feat: added deepFreeze to not pollute global mock data - Part 7

* minor

* feat: added deepFreeze to not pollute global mock data - Part 8 (#2922)

* feat: added deepFreeze to not pollute global mock data - Part 8

* feat: added deepFreeze to not pollute global mock data - Part 9 (#2924)

* feat: added deepFreeze to not pollute global mock data - Part 9

* feat: added deepFreeze to not pollute global mock data - Part 10 (#2925)

* feat: added deepFreeze to not pollute global mock data - Part 10

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

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

* feat: added deepFreeze to not pollute global mock data - Part 12 (#2929)

* feat: added deepFreeze to not pollute global mock data - Part 12

* feat: added deepFreeze to not pollute global mock data - Part 13 (#2930)

* feat: added deepFreeze to not pollute global mock data - Part 13

* minor

* feat: added deepFreeze to not pollute global mock data - Part 14 (#2933)

* feat: added deepFreeze to not pollute global mock data - Part 14

* feat: added deepFreeze to not pollute global mock data - Part 15 (#2934)

* feat: added deepFreeze to not pollute global mock data - Part 15

* test: fixing tests - part 1 (#2939)

* test: fixing tests - part 1

* test: fixing tests - part 2 (#2940)

* test: fixing tests - part 2

* test: fixing tests - part 3 (#2941)

* test: fixing tests - part 3

* test: fixing tests - part 4 (#2943)

* test: fixing tests - part 4

* test: fixing tests - part 5 (#2945)

* minor
  • Loading branch information
suyashpatil78 authored May 4, 2024
1 parent bdb0701 commit b4d7228
Show file tree
Hide file tree
Showing 259 changed files with 3,662 additions and 3,088 deletions.
6 changes: 4 additions & 2 deletions src/app/core/mock-data/account-option.data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import deepFreeze from 'deep-freeze-strict';

import { AccountOption } from '../models/account-option.model';
import { multiplePaymentModesData } from '../test-data/accounts.service.spec.data';

export const accountOptionData1: AccountOption[] = [
export const accountOptionData1: AccountOption[] = deepFreeze([
{
label: 'account1',
value: multiplePaymentModesData[0],
Expand All @@ -10,4 +12,4 @@ export const accountOptionData1: AccountOption[] = [
label: 'account2',
value: multiplePaymentModesData[1],
},
];
]);
10 changes: 6 additions & 4 deletions src/app/core/mock-data/acess-token-data.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { AccessTokenData } from '../models/access-token-data.model';

export const apiAccessTokenRes: AccessTokenData = {
export const apiAccessTokenRes: AccessTokenData = deepFreeze({
iat: 1678349549,
iss: 'FyleApp',
user_id: 'usvKA4X8Ugcr',
Expand All @@ -12,9 +14,9 @@ export const apiAccessTokenRes: AccessTokenData = {
version: '3',
cluster_domain: '"https://staging.fyle.tech"',
exp: 1678353149,
};
});

export const apiTokenWithoutRoles: AccessTokenData = {
export const apiTokenWithoutRoles: AccessTokenData = deepFreeze({
iat: 1678349549,
iss: 'FyleApp',
user_id: 'usvKA4X8Ugcr',
Expand All @@ -25,4 +27,4 @@ export const apiTokenWithoutRoles: AccessTokenData = {
version: '3',
cluster_domain: '"https://staging.fyle.tech"',
exp: 1678353149,
};
});
18 changes: 10 additions & 8 deletions src/app/core/mock-data/action-sheet-options.data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const actionSheetOptionsData = [
import deepFreeze from 'deep-freeze-strict';

export const actionSheetOptionsData = deepFreeze([
{
text: 'Split Expense By Category',
handler: () => {},
Expand All @@ -19,8 +21,8 @@ export const actionSheetOptionsData = [
text: 'Remove Card Expense',
handler: () => {},
},
];
export const expectedActionSheetButtonRes = [
]);
export const expectedActionSheetButtonRes = deepFreeze([
{
text: 'Capture Receipt',
icon: 'assets/svg/camera.svg',
Expand All @@ -45,9 +47,9 @@ export const expectedActionSheetButtonRes = [
cssClass: 'capture-receipt',
handler: undefined,
},
];
]);

export const expectedActionSheetButtonsWithMileage = [
export const expectedActionSheetButtonsWithMileage = deepFreeze([
{
text: 'Capture Receipt',
icon: 'assets/svg/camera.svg',
Expand All @@ -66,9 +68,9 @@ export const expectedActionSheetButtonsWithMileage = [
cssClass: 'capture-receipt',
handler: undefined,
},
];
]);

export const expectedActionSheetButtonsWithPerDiem = [
export const expectedActionSheetButtonsWithPerDiem = deepFreeze([
{
text: 'Capture Receipt',
icon: 'assets/svg/camera.svg',
Expand All @@ -87,4 +89,4 @@ export const expectedActionSheetButtonsWithPerDiem = [
cssClass: 'capture-receipt',
handler: undefined,
},
];
]);
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import deepFreeze from 'deep-freeze-strict';

import { AddEditAdvanceRequestFormValue } from '../models/add-edit-advance-request-form-value.model';
import { recentlyUsedProjectRes } from './recently-used.data';

export const addEditAdvanceRequestFormValueData: AddEditAdvanceRequestFormValue = {
export const addEditAdvanceRequestFormValueData: AddEditAdvanceRequestFormValue = deepFreeze({
currencyObj: {
amount: 130,
currency: 'USD',
Expand All @@ -12,17 +14,17 @@ export const addEditAdvanceRequestFormValueData: AddEditAdvanceRequestFormValue
notes: 'Test notes',
project: null,
customFieldValues: null,
};
});

export const addEditAdvanceRequestFormValueData2: AddEditAdvanceRequestFormValue = {
export const addEditAdvanceRequestFormValueData2: AddEditAdvanceRequestFormValue = deepFreeze({
currencyObj: null,
purpose: null,
notes: null,
project: null,
customFieldValues: [],
};
});

export const addEditAdvanceRequestFormValueData3: AddEditAdvanceRequestFormValue = {
export const addEditAdvanceRequestFormValueData3: AddEditAdvanceRequestFormValue = deepFreeze({
...addEditAdvanceRequestFormValueData,
project: recentlyUsedProjectRes[0],
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/advance-platform.data.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import deepFreeze from 'deep-freeze-strict';

import { CustomFieldTypes } from '../enums/platform/v1/custom-fields-type.enum';
import { AdvancesPlatform } from '../models/platform/advances-platform.model';
import { PlatformApiResponse } from '../models/platform/platform-api-response.model';

export const advancePlatform: PlatformApiResponse<AdvancesPlatform> = {
export const advancePlatform: PlatformApiResponse<AdvancesPlatform> = deepFreeze({
count: 1,
offset: 0,
data: [
Expand Down Expand Up @@ -85,4 +87,4 @@ export const advancePlatform: PlatformApiResponse<AdvancesPlatform> = {
},
},
],
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/advance-request-actions.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { AdvanceRequestActions } from '../models/advance-request-actions.model';

export const apiAdvanceRequestAction: AdvanceRequestActions = {
export const apiAdvanceRequestAction: AdvanceRequestActions = deepFreeze({
id: 'areqoVuT5I8OOy',
can_save: true,
can_submit: true,
Expand All @@ -13,4 +15,4 @@ export const apiAdvanceRequestAction: AdvanceRequestActions = {
can_pull_back: false,
can_pay: false,
can_delete: true,
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/advance-request-approver.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { AdvanceApprover } from '../models/approver.model';

export const AdvanceRequestApprover: AdvanceApprover[] = [
export const AdvanceRequestApprover: AdvanceApprover[] = deepFreeze([
{
id: 8311,
created_at: null,
Expand All @@ -15,4 +17,4 @@ export const AdvanceRequestApprover: AdvanceApprover[] = [
approver_org_id: 'orYtMVz2qisQ',
comment: null,
},
];
]);
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { AdvanceRequestCustomFieldValues } from '../models/advance-request-custom-field-values.model';

export const advanceRequestCustomFieldValuesData: AdvanceRequestCustomFieldValues[] = [
export const advanceRequestCustomFieldValuesData: AdvanceRequestCustomFieldValues[] = deepFreeze([
{
name: 'Phase',
value: 'Phase 1',
Expand All @@ -21,9 +23,9 @@ export const advanceRequestCustomFieldValuesData: AdvanceRequestCustomFieldValue
value: 'option1',
type: 'OPTION',
},
];
]);

export const advanceRequestCustomFieldValuesData2: AdvanceRequestCustomFieldValues[] = [
export const advanceRequestCustomFieldValuesData2: AdvanceRequestCustomFieldValues[] = deepFreeze([
{
name: 'Phase',
value: 'Phase 1',
Expand All @@ -40,4 +42,4 @@ export const advanceRequestCustomFieldValuesData2: AdvanceRequestCustomFieldValu
name: 'Checking',
value: 'option1',
},
];
]);
10 changes: 6 additions & 4 deletions src/app/core/mock-data/advance-request-file.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { AdvanceRequestFile } from '../models/advance-request-file.model';

export const advRequestFile: AdvanceRequestFile = {
export const advRequestFile: AdvanceRequestFile = deepFreeze({
files: [
{
id: 'fi1w2IE6JeqS',
Expand Down Expand Up @@ -92,9 +94,9 @@ export const advRequestFile: AdvanceRequestFile = {
is_sent_back: false,
is_pulled_back: true,
},
};
});

export const advRequestFile2: AdvanceRequestFile = {
export const advRequestFile2: AdvanceRequestFile = deepFreeze({
files: [
{
id: 'fiK7c69UDJNb',
Expand Down Expand Up @@ -186,4 +188,4 @@ export const advRequestFile2: AdvanceRequestFile = {
is_sent_back: false,
is_pulled_back: true,
},
};
});
10 changes: 6 additions & 4 deletions src/app/core/mock-data/advance-requests-custom-fields.data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import deepFreeze from 'deep-freeze-strict';

import { AdvanceRequestsCustomFields } from '../models/advance-requests-custom-fields.model';
export const advanceRequestCustomFieldData: AdvanceRequestsCustomFields[] = [
export const advanceRequestCustomFieldData: AdvanceRequestsCustomFields[] = deepFreeze([
{
id: 150,
org_id: 'orNVthTo2Zyo',
Expand Down Expand Up @@ -42,9 +44,9 @@ export const advanceRequestCustomFieldData: AdvanceRequestsCustomFields[] = [
last_updated_by: 'ouX8dwsbLCLv',
placeholder: '123',
},
];
]);

export const advanceRequestCustomFieldData2: AdvanceRequestsCustomFields[] = [
export const advanceRequestCustomFieldData2: AdvanceRequestsCustomFields[] = deepFreeze([
{
id: 150,
org_id: 'orNVthTo2Zyo',
Expand Down Expand Up @@ -87,4 +89,4 @@ export const advanceRequestCustomFieldData2: AdvanceRequestsCustomFields[] = [
last_updated_by: 'ouX8dwsbLCLv',
placeholder: null,
},
];
]);
42 changes: 22 additions & 20 deletions src/app/core/mock-data/advance-requests.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { AdvanceRequests } from '../models/advance-requests.model';

export const advanceRequests: AdvanceRequests = {
export const advanceRequests: AdvanceRequests = deepFreeze({
id: 'areqMP09oaYXBf',
created_at: new Date('2023-02-23T16:24:01.335Z'),
approved_at: null,
Expand Down Expand Up @@ -73,14 +75,14 @@ export const advanceRequests: AdvanceRequests = {
updated_by: null,
is_sent_back: false,
is_pulled_back: true,
};
});

export const pullBackAdvancedRequests: AdvanceRequests = {
export const pullBackAdvancedRequests: AdvanceRequests = deepFreeze({
...advanceRequests,
is_pulled_back: true,
};
});

export const expectedSingleErq = {
export const expectedSingleErq = deepFreeze({
id: 'areqGzKF1Tne23',
created_at: '2023-02-23T02:16:15.260Z',
approved_at: null,
Expand All @@ -102,14 +104,14 @@ export const expectedSingleErq = {
updated_by: null,
is_sent_back: null,
is_pulled_back: null,
};
});

export const advancedRequests2: AdvanceRequests = {
export const advancedRequests2: AdvanceRequests = deepFreeze({
...advanceRequests,
id: 'areq99bN9mZgu1',
};
});

export const draftAdvancedRequestRes: AdvanceRequests = {
export const draftAdvancedRequestRes: AdvanceRequests = deepFreeze({
id: 'areqo6m2UmDSfq',
created_at: new Date('2023-02-24T12:28:18.700Z'),
updated_at: new Date('2023-02-24T12:28:18.700Z'),
Expand Down Expand Up @@ -191,9 +193,9 @@ export const draftAdvancedRequestRes: AdvanceRequests = {
type: null,
},
],
};
});

export const draftAdvancedRequestParam = {
export const draftAdvancedRequestParam = deepFreeze({
org_user_id: 'ouX8dwsbLCLv',
currency: 'USD',
source: 'MOBILE',
Expand Down Expand Up @@ -254,9 +256,9 @@ export const draftAdvancedRequestParam = {
value: false,
},
],
};
});

export const rejectedAdvReqRes: AdvanceRequests = {
export const rejectedAdvReqRes: AdvanceRequests = deepFreeze({
id: 'areqVU0Xr5suPC',
created_at: new Date('2023-02-24T12:48:00.608Z'),
updated_at: new Date('2023-02-24T12:48:48.860Z'),
Expand Down Expand Up @@ -338,9 +340,9 @@ export const rejectedAdvReqRes: AdvanceRequests = {
type: 'BOOLEAN',
},
],
};
});

export const checkPolicyAdvReqParam: AdvanceRequests = {
export const checkPolicyAdvReqParam: AdvanceRequests = deepFreeze({
id: 'areq4YujEm52Ub',
created_at: new Date('2023-02-23T19:37:01.207Z'),
approved_at: null,
Expand Down Expand Up @@ -378,9 +380,9 @@ export const checkPolicyAdvReqParam: AdvanceRequests = {
updated_by: null,
is_sent_back: null,
is_pulled_back: true,
};
});

export const advanceRequests2: Partial<AdvanceRequests> = {
export const advanceRequests2: Partial<AdvanceRequests> = deepFreeze({
...advanceRequests,
currency: 'USD',
amount: 130,
Expand All @@ -389,11 +391,11 @@ export const advanceRequests2: Partial<AdvanceRequests> = {
notes: 'Test notes',
source: 'MOBILE',
custom_field_values: null,
};
});

export const advanceRequests3: Partial<AdvanceRequests> = {
export const advanceRequests3: Partial<AdvanceRequests> = deepFreeze({
org_user_id: 'ouX8dwsbLCLv',
currency: 'GNF',
source: 'MOBILE',
created_at: new Date(),
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/allowed-actions.data.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import deepFreeze from 'deep-freeze-strict';

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

export const reportAllowedActionsResponse: ReportAllowedActions = {
export const reportAllowedActionsResponse: ReportAllowedActions = deepFreeze({
allowedRouteAccess: true,
approve: true,
create: true,
delete: true,
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/allowed-expense-types.data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const allowedExpenseTypes: Record<string, boolean> = {
import deepFreeze from 'deep-freeze-strict';

export const allowedExpenseTypes: Record<string, boolean> = deepFreeze({
mileage: true,
perDiem: true,
};
});
Loading

0 comments on commit b4d7228

Please sign in to comment.