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 6 #2918

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 8 additions & 6 deletions src/app/core/mock-data/individual-expense-policy-state.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { IndividualExpensePolicyState } from '../models/platform/platform-individual-expense-policy-state.model';

export const individualExpPolicyStateData1: IndividualExpensePolicyState = {
export const individualExpPolicyStateData1: IndividualExpensePolicyState = deepFreeze({
add_approver_user_ids: [],
amount: 0,
expense_policy_rule: {
Expand All @@ -15,9 +17,9 @@ export const individualExpPolicyStateData1: IndividualExpensePolicyState = {
'expense could not be added to a report or submitted',
],
run_status: 'VIOLATED_ACTION_SUCCESS',
};
});

export const individualExpPolicyStateData2: IndividualExpensePolicyState[] = [
export const individualExpPolicyStateData2: IndividualExpensePolicyState[] = deepFreeze([
{
add_approver_user_ids: [],
amount: 0,
Expand Down Expand Up @@ -46,9 +48,9 @@ export const individualExpPolicyStateData2: IndividualExpensePolicyState[] = [
run_result: ['expense will be flagged for verification and approval'],
run_status: 'VIOLATED_ACTION_SUCCESS',
},
];
]);

export const individualExpPolicyStateData3: IndividualExpensePolicyState[] = [
export const individualExpPolicyStateData3: IndividualExpensePolicyState[] = deepFreeze([
{
add_approver_user_ids: [],
amount: null,
Expand All @@ -75,4 +77,4 @@ export const individualExpPolicyStateData3: IndividualExpensePolicyState[] = [
run_result: ['expense will be flagged for verification and approval'],
run_status: 'VIOLATED_ACTION_SUCCESS',
},
];
]);
6 changes: 4 additions & 2 deletions src/app/core/mock-data/info-card-data.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { InfoCardData } from '../models/info-card-data.model';

export const allInfoCardsData: InfoCardData[] = [
export const allInfoCardsData: InfoCardData[] = deepFreeze([
{
title: 'Message Receipts',
content: 'Message your receipts to Fyle at (302) 440-2921.',
Expand All @@ -15,4 +17,4 @@ export const allInfoCardsData: InfoCardData[] = [
toastMessageContent: 'Email Copied Successfully',
isShown: true,
},
];
]);
6 changes: 4 additions & 2 deletions src/app/core/mock-data/ld-all-flags.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import * as LDClient from 'launchdarkly-js-client-sdk';

export const ldAllFlagsRes: LDClient.LDFlagValue = {
export const ldAllFlagsRes: LDClient.LDFlagValue = deepFreeze({
approve_report_and_next_enabled: true,
automate_report_submission_enabled: true,
automate_reports_weekly: true,
Expand All @@ -20,4 +22,4 @@ export const ldAllFlagsRes: LDClient.LDFlagValue = {
payment_mode_configurations: true,
remove_offline_forms: true,
upload_receipt_first_flow: false,
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/ld-client-user.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import * as LDClient from 'launchdarkly-js-client-sdk';

export const lDUser: LDClient.LDUser = {
export const lDUser: LDClient.LDUser = deepFreeze({
key: 'usvKA4X8Ugcr',
custom: {
org_id: 'orNVthTo2Zyo',
Expand All @@ -9,4 +11,4 @@ export const lDUser: LDClient.LDUser = {
org_created_at: '2018-01-31T23:50:27.216Z',
asset: 'MOBILE - WEB',
},
};
});
30 changes: 16 additions & 14 deletions src/app/core/mock-data/location.data.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
import deepFreeze from 'deep-freeze-strict';

import { Position } from '@capacitor/geolocation';
import { Location } from '../models/location.model';
import { PredictedLocation } from '../models/predicted-location.model';
export const locationData1: Location = {
export const locationData1: Location = deepFreeze({
city: 'Kolkata',
state: 'West Bengal',
country: 'India',
formatted_address: 'Tollygunge, Kolkata, West Bengal, India',
latitude: 22.4986357,
longitude: 88.3453906,
display: 'Tollygunge, Kolkata, West Bengal, India',
};
});

export const locationData2: Location = {
export const locationData2: Location = deepFreeze({
city: 'Kolkata',
state: 'West Bengal',
country: 'India',
formatted_address: 'Howrah Bridge, Kolkata, West Bengal 700001, India',
latitude: 22.5851477,
longitude: 88.34680530000001,
display: 'Howrah Bridge, Kolkata, West Bengal, India',
};
});

export const locationData3: Location = {
export const locationData3: Location = deepFreeze({
city: 'Kolkata',
state: 'West Bengal',
country: 'India',
formatted_address: 'Park St, Mullick Bazar, Park Street area, Kolkata, West Bengal, India',
latitude: 22.5474164,
longitude: 88.3598025,
display: 'Park Street, Mullick Bazar, Beniapukur, Kolkata, West Bengal, India',
};
});

export const locationData4: Location = {
export const locationData4: Location = deepFreeze({
city: 'Thane',
state: 'Maharashtra',
country: 'India',
formatted_address: 'Thane, Maharashtra, India',
latitude: 19.2183307,
longitude: 72.9780897,
display: 'Thane, Maharashtra, India',
};
});

export const predictedLocation1: PredictedLocation[] = [
export const predictedLocation1: PredictedLocation[] = deepFreeze([
{
description: 'Bengaluru, Karnataka, India',
matched_substrings: [
Expand Down Expand Up @@ -158,9 +160,9 @@ export const predictedLocation1: PredictedLocation[] = [
],
types: ['locality', 'political', 'geocode'],
},
];
]);

export const coordinatesData1: Position = {
export const coordinatesData1: Position = deepFreeze({
timestamp: Date.now(),
coords: {
latitude: 10.12,
Expand All @@ -171,9 +173,9 @@ export const coordinatesData1: Position = {
speed: 0.099,
heading: 0,
},
};
});

export const coordinatesData2: Position = {
export const coordinatesData2: Position = deepFreeze({
timestamp: Date.now(),
coords: {
latitude: 19.0748,
Expand All @@ -184,4 +186,4 @@ export const coordinatesData2: Position = {
speed: 0.099,
heading: 0,
},
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/matchedCCCTransaction.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { MatchedCCCTransaction } from '../models/matchedCCCTransaction.model';

export const matchedCCCTransactionData1: MatchedCCCTransaction = {
export const matchedCCCTransactionData1: MatchedCCCTransaction = deepFreeze({
amount: -680.62,
balance_transfer_id: null,
card_or_account_number: '9880',
Expand All @@ -18,4 +20,4 @@ export const matchedCCCTransactionData1: MatchedCCCTransaction = {
txn_dt: '2019-07-13T00:00:00.000Z',
updated_at: '2023-07-17T13:24:47.274Z',
vendor: 'HOTEL MARRIOT',
};
});
14 changes: 8 additions & 6 deletions src/app/core/mock-data/matchedCCTransaction.data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import deepFreeze from 'deep-freeze-strict';

import { MatchedCCCTransaction } from '../models/matchedCCCTransaction.model';
import { TransactionStatus } from '../models/platform/v1/expense.model';

export const matchedCCTransactionData: Partial<MatchedCCCTransaction> = {
export const matchedCCTransactionData: Partial<MatchedCCCTransaction> = deepFreeze({
id: 'btxnSte7sVQCM8',
group_id: 'btxnSte7sVQCM8',
amount: 260.37,
Expand All @@ -15,9 +17,9 @@ export const matchedCCTransactionData: Partial<MatchedCCCTransaction> = {
orig_currency: null,
status: TransactionStatus.PENDING,
displayObject: 'Jul 3, 2018 - test description260.37',
};
});

export const matchedCCTransactionData2: Partial<MatchedCCCTransaction> = {
export const matchedCCTransactionData2: Partial<MatchedCCCTransaction> = deepFreeze({
id: 'btxnBdS2Kpvzhy',
group_id: 'btxnBdS2Kpvzhy',
amount: 205.21,
Expand All @@ -31,9 +33,9 @@ export const matchedCCTransactionData2: Partial<MatchedCCCTransaction> = {
orig_currency: null,
status: TransactionStatus.PENDING,
displayObject: 'Jun 6, 2018 - test description205.21',
};
});

export const matchedCCTransactionData3: Partial<MatchedCCCTransaction> = {
export const matchedCCTransactionData3: Partial<MatchedCCCTransaction> = deepFreeze({
id: 'btxnBdS2Kpvzhy',
group_id: 'btxnBdS2Kpvzhy',
created_at: '2024-01-23T12:17:34.473632+00:00',
Expand All @@ -50,4 +52,4 @@ export const matchedCCTransactionData3: Partial<MatchedCCCTransaction> = {
orig_amount: null,
orig_currency: null,
status: undefined,
};
});
22 changes: 12 additions & 10 deletions src/app/core/mock-data/merge-expense-form-data.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { optionsData15, optionsData33 } from './merge-expenses-options-data.data';

export const mergeExpenseFormData1 = {
export const mergeExpenseFormData1 = deepFreeze({
genericFields: {
paymentMode: 'CORPORATE_CARD',
amount: 'tx3nHShG60zq',
Expand All @@ -23,9 +25,9 @@ export const mergeExpenseFormData1 = {
location_1: optionsData15.options[0].value,
location_2: optionsData33.options[0].value,
},
};
});

export const mergeExpenseFormData2 = {
export const mergeExpenseFormData2 = deepFreeze({
genericFields: {
paymentMode: 'CORPORATE_CARD',
amount: 'tx3nHShG60zq',
Expand All @@ -47,9 +49,9 @@ export const mergeExpenseFormData2 = {
categoryDependent: {
location_1: optionsData15.options[0].value,
},
};
});

export const mergeExpenseFormData3 = {
export const mergeExpenseFormData3 = deepFreeze({
genericFields: {
paymentMode: 'CORPORATE_CARD',
amount: 'tx3nHShG60zq',
Expand All @@ -69,9 +71,9 @@ export const mergeExpenseFormData3 = {
],
},
categoryDependent: {},
};
});

export const mergeExpenseFormData4 = {
export const mergeExpenseFormData4 = deepFreeze({
genericFields: {
paymentMode: 'CORPORATE_CARD',
amount: 'tx3nHShG60zq',
Expand All @@ -92,9 +94,9 @@ export const mergeExpenseFormData4 = {
location_1: optionsData15.options[0].value,
location_2: optionsData33.options[0].value,
},
};
});

export const mergeExpenseFormData5 = {
export const mergeExpenseFormData5 = deepFreeze({
genericFields: {
paymentMode: 'CORPORATE_CARD',
amount: 'tx3nHShG6035',
Expand All @@ -115,4 +117,4 @@ export const mergeExpenseFormData5 = {
location_1: optionsData15.options[0].value,
location_2: optionsData33.options[0].value,
},
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/merge-expenses-custom-inputs.data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const mergeExpenesesCustomInputsData = [
import deepFreeze from 'deep-freeze-strict';

export const mergeExpenesesCustomInputsData = deepFreeze([
[
{
name: 'status',
Expand All @@ -13,4 +15,4 @@ export const mergeExpenesesCustomInputsData = [
value: null,
},
],
];
]);
Loading
Loading