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 7 #2919

Merged
merged 3 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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,
},
],
];
]);
76 changes: 39 additions & 37 deletions src/app/core/mock-data/merge-expenses-option.data.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
import deepFreeze from 'deep-freeze-strict';

import { AccountType } from '../enums/account-type.enum';
import { MergeExpensesOption } from '../models/merge-expenses-option.model';

export const billableOptions1: MergeExpensesOption<boolean> = {
export const billableOptions1: MergeExpensesOption<boolean> = deepFreeze({
label: 'Yes',
value: true,
};
});

export const billableOptions2: MergeExpensesOption<boolean> = {
export const billableOptions2: MergeExpensesOption<boolean> = deepFreeze({
label: 'No',
value: false,
};
});

export const paymentModeOptions1: MergeExpensesOption<string> = {
export const paymentModeOptions1: MergeExpensesOption<string> = deepFreeze({
label: 'Personal Card/Cash',
value: AccountType.PERSONAL,
};
});

export const paymentModeOptions2: MergeExpensesOption<string> = {
export const paymentModeOptions2: MergeExpensesOption<string> = deepFreeze({
label: 'Advance',
value: AccountType.ADVANCE,
};
});

export const paymentModeOptions3: MergeExpensesOption<string> = {
export const paymentModeOptions3: MergeExpensesOption<string> = deepFreeze({
label: 'Corporate Card',
value: AccountType.CCC,
};
});

export const sameOptions: MergeExpensesOption<boolean>[] = [billableOptions1, billableOptions1];
export const sameOptions: MergeExpensesOption<boolean>[] = deepFreeze([billableOptions1, billableOptions1]);

export const mergeExpensesOptionsData: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionsData: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'Receipt From Expense 1 ',
value: 'tx3nHShG60zq',
},
];
]);

export const projectOptionsData: MergeExpensesOption<number> = {
export const projectOptionsData: MergeExpensesOption<number> = deepFreeze({
label: 'Staging Project',
value: 3943,
};
});

export const categoryOptionsData: MergeExpensesOption<number>[] = [
export const categoryOptionsData: MergeExpensesOption<number>[] = deepFreeze([
{
label: 'Food / Travelling - Inland',
value: 201952,
Expand All @@ -49,9 +51,9 @@ export const categoryOptionsData: MergeExpensesOption<number>[] = [
label: 'Unspecified',
value: 16582,
},
];
]);

export const mergeExpensesOptionData1: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData1: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'Mar 13 ₹1.00 Nilesh As Vendor - Staging Project',
value: 'txKJAJ1flx7n',
Expand All @@ -60,9 +62,9 @@ export const mergeExpensesOptionData1: MergeExpensesOption<string>[] = [
label: 'Mar 08 ₹1.00 Nilesh As Vendor - Staging Project',
value: 'txz2vohKxBXu',
},
];
]);

export const mergeExpensesOptionData2: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData2: MergeExpensesOption<string>[] = deepFreeze([
{
label: ' Nilesh As Vendor - Staging Project',
value: 'txKJAJ1flx7n',
Expand All @@ -71,9 +73,9 @@ export const mergeExpensesOptionData2: MergeExpensesOption<string>[] = [
label: ' Nilesh As Vendor - Staging Project',
value: 'txz2vohKxBXu',
},
];
]);

export const mergeExpensesOptionData3: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData3: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'Staging Project',
value: '3943',
Expand All @@ -82,9 +84,9 @@ export const mergeExpensesOptionData3: MergeExpensesOption<string>[] = [
label: 'Staging Project',
value: '3943',
},
];
]);

export const mergeExpensesOptionData4: MergeExpensesOption<number>[] = [
export const mergeExpensesOptionData4: MergeExpensesOption<number>[] = deepFreeze([
{
label: 'Food',
value: 201952,
Expand All @@ -93,9 +95,9 @@ export const mergeExpensesOptionData4: MergeExpensesOption<number>[] = [
label: 'Hotel',
value: 16582,
},
];
]);

export const mergeExpensesOptionData5: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData5: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'GST',
value: 'tgXEJA6YUoZ1',
Expand All @@ -104,9 +106,9 @@ export const mergeExpensesOptionData5: MergeExpensesOption<string>[] = [
label: 'GST',
value: 'tgXEJA6YUoZ1',
},
];
]);

export const mergeExpensesOptionData6: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData6: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'ECONOMY',
value: 'ECONOMY',
Expand All @@ -115,9 +117,9 @@ export const mergeExpensesOptionData6: MergeExpensesOption<string>[] = [
label: 'BUSINESS',
value: 'BUSINESS',
},
];
]);

export const mergeExpensesOptionData7: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData7: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'SLEEPER',
value: 'SLEEPER',
Expand All @@ -126,9 +128,9 @@ export const mergeExpensesOptionData7: MergeExpensesOption<string>[] = [
label: 'SLEEPER',
value: 'SLEEPER',
},
];
]);

export const mergeExpensesOptionData8: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData8: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'AC',
value: 'AC',
Expand All @@ -137,9 +139,9 @@ export const mergeExpensesOptionData8: MergeExpensesOption<string>[] = [
label: 'AC',
value: 'AC',
},
];
]);

export const mergeExpensesOptionData9: MergeExpensesOption<number>[] = [
export const mergeExpensesOptionData9: MergeExpensesOption<number>[] = deepFreeze([
{
label: '25',
value: 25,
Expand All @@ -148,9 +150,9 @@ export const mergeExpensesOptionData9: MergeExpensesOption<number>[] = [
label: '30',
value: 30,
},
];
]);

export const mergeExpensesOptionData10: MergeExpensesOption<string>[] = [
export const mergeExpensesOptionData10: MergeExpensesOption<string>[] = deepFreeze([
{
label: 'KM',
value: 'KM',
Expand All @@ -159,4 +161,4 @@ export const mergeExpensesOptionData10: MergeExpensesOption<string>[] = [
label: 'MILES',
value: 'MILES',
},
];
]);
Loading
Loading