Skip to content

Commit

Permalink
feat: added deepFreeze to not pollute global mock data - Part 2 (#2914)
Browse files Browse the repository at this point in the history
* 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 05e35db commit 37c647c
Show file tree
Hide file tree
Showing 238 changed files with 3,492 additions and 2,960 deletions.
6 changes: 4 additions & 2 deletions src/app/core/mock-data/bank-feed-sources.data.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import deepFreeze from 'deep-freeze-strict';

import { DataFeedSource } from '../enums/data-feed-source.enum';

export const bankFeedSourcesData: DataFeedSource[] = [
export const bankFeedSourcesData: DataFeedSource[] = deepFreeze([
DataFeedSource.BANK_FEED_AMEX,
DataFeedSource.BANK_FEED_CDF,
DataFeedSource.BANK_FEED_VCF,
DataFeedSource.BANK_FEED_S3DF,
DataFeedSource.BANK_FEED_HAPPAY,
];
]);
14 changes: 8 additions & 6 deletions src/app/core/mock-data/card-aggregate-stats.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { CardAggregateStats } from '../models/card-aggregate-stats.model';

export const cardAggregateStatParam: CardAggregateStats[] = [
export const cardAggregateStatParam: CardAggregateStats[] = deepFreeze([
{
aggregates: [
{
Expand Down Expand Up @@ -79,9 +81,9 @@ export const cardAggregateStatParam: CardAggregateStats[] = [
},
],
},
];
]);

export const cardAggregateStatParam2: CardAggregateStats[] = [
export const cardAggregateStatParam2: CardAggregateStats[] = deepFreeze([
{
aggregates: [],
key: [
Expand Down Expand Up @@ -151,9 +153,9 @@ export const cardAggregateStatParam2: CardAggregateStats[] = [
},
],
},
];
]);

export const cardAggregateStatParam3: CardAggregateStats[] = [
export const cardAggregateStatParam3: CardAggregateStats[] = deepFreeze([
{
aggregates: [
{
Expand All @@ -180,4 +182,4 @@ export const cardAggregateStatParam3: CardAggregateStats[] = [
},
],
},
];
]);
10 changes: 6 additions & 4 deletions src/app/core/mock-data/cc-transaction.data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import deepFreeze from 'deep-freeze-strict';

import { corporateCardTransaction } from '../models/platform/v1/cc-transaction.model';
import { TransactionStatus } from '../models/platform/v1/expense.model';

export const ccTransactionData: corporateCardTransaction = {
export const ccTransactionData: corporateCardTransaction = deepFreeze({
amount: 260.37,
assignor_user: null,
assignor_user_id: null,
Expand Down Expand Up @@ -104,9 +106,9 @@ export const ccTransactionData: corporateCardTransaction = {
id: 'usvMoPfCC9Xw',
},
user_id: 'usvMoPfCC9Xw',
};
});

export const ccTransactionData1: corporateCardTransaction = {
export const ccTransactionData1: corporateCardTransaction = deepFreeze({
amount: 205.21,
assignor_user: null,
assignor_user_id: null,
Expand Down Expand Up @@ -193,4 +195,4 @@ export const ccTransactionData1: corporateCardTransaction = {
id: 'usvMoPfCC9Xw',
},
user_id: 'usvMoPfCC9Xw',
};
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import deepFreeze from 'deep-freeze-strict';

import { ApiV2Response } from '../models/v2/api-v2-response.model';
import { CorporateCardExpense } from '../models/v2/corporate-card-expense.model';

export const apiCardV2Transactions: ApiV2Response<CorporateCardExpense> = {
export const apiCardV2Transactions: ApiV2Response<CorporateCardExpense> = deepFreeze({
count: 2,
data: [
{
Expand Down Expand Up @@ -97,4 +99,4 @@ export const apiCardV2Transactions: ApiV2Response<CorporateCardExpense> = {
limit: 2,
offset: 0,
url: '/v2/corporate_card_transactions',
};
});
14 changes: 8 additions & 6 deletions src/app/core/mock-data/ccc-expense.details.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { CCCDetails } from '../models/ccc-expense-details.model';

export const expectedAssignedCCCStats: CCCDetails = {
export const expectedAssignedCCCStats: CCCDetails = deepFreeze({
totalTxns: 1090,
totalAmount: 589553.832,
cardDetails: [
Expand Down Expand Up @@ -57,9 +59,9 @@ export const expectedAssignedCCCStats: CCCDetails = {
],
},
],
};
});

export const mastercardCCCStats: CCCDetails = {
export const mastercardCCCStats: CCCDetails = deepFreeze({
totalTxns: 12,
totalAmount: 1874.4,
cardDetails: [
Expand Down Expand Up @@ -116,10 +118,10 @@ export const mastercardCCCStats: CCCDetails = {
],
},
],
};
});

export const emptyCCCStats: CCCDetails = {
export const emptyCCCStats: CCCDetails = deepFreeze({
totalTxns: 0,
totalAmount: 0,
cardDetails: [],
};
});
14 changes: 8 additions & 6 deletions src/app/core/mock-data/combined-options.data.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import deepFreeze from 'deep-freeze-strict';

import { CombinedOptions } from '../models/combined-options.model';
import {
optionsData10,
Expand All @@ -22,7 +24,7 @@ import {
optionsData9,
} from './merge-expenses-options-data.data';

export const combinedOptionsData1 = {
export const combinedOptionsData1 = deepFreeze({
amountOptionsData: optionsData3,
dateOfSpendOptionsData: optionsData6,
paymentModeOptionsData: optionsData7,
Expand All @@ -34,15 +36,15 @@ export const combinedOptionsData1 = {
taxAmountOptionsData: optionsData12,
constCenterOptionsData: optionsData13,
purposeOptionsData: optionsData14,
};
});

export const combinedOptionsData2: CombinedOptions<string | Date | boolean> = {
export const combinedOptionsData2: CombinedOptions<string | Date | boolean> = deepFreeze({
userlist: optionsData3,
test: optionsData6,
category2: optionsData31,
};
});

export const combinedOptionsData3 = {
export const combinedOptionsData3 = deepFreeze({
location1OptionsData: optionsData15,
location2OptionsData: optionsData33,
onwardDateOptionsData: optionsData16,
Expand All @@ -53,4 +55,4 @@ export const combinedOptionsData3 = {
busTravelClassOptionsData: optionsData19,
distanceOptionsData: optionsData20,
distanceUnitOptionsData: optionsData21,
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/commute-deduction-options.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { CommuteDeductionOptions } from '../models/commute-deduction-options.model';

export const commuteDeductionOptionsData1: CommuteDeductionOptions[] = [
export const commuteDeductionOptionsData1: CommuteDeductionOptions[] = deepFreeze([
{
label: 'One Way Distance',
value: 'ONE_WAY',
Expand All @@ -16,4 +18,4 @@ export const commuteDeductionOptionsData1: CommuteDeductionOptions[] = [
value: 'NO_DEDUCTION',
distance: 0,
},
];
]);
14 changes: 8 additions & 6 deletions src/app/core/mock-data/commute-details-response.data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import deepFreeze from 'deep-freeze-strict';

import { CommuteDetailsResponse } from '../models/platform/commute-details-response.model';
import { PlatformApiResponse } from '../models/platform/platform-api-response.model';

export const commuteDetailsResponseData: PlatformApiResponse<CommuteDetailsResponse> = {
export const commuteDetailsResponseData: PlatformApiResponse<CommuteDetailsResponse> = deepFreeze({
count: 1,
offset: 0,
data: [
Expand Down Expand Up @@ -31,15 +33,15 @@ export const commuteDetailsResponseData: PlatformApiResponse<CommuteDetailsRespo
},
},
],
};
});

export const commuteDetailsResponseData2: PlatformApiResponse<CommuteDetailsResponse> = {
export const commuteDetailsResponseData2: PlatformApiResponse<CommuteDetailsResponse> = deepFreeze({
count: 1,
offset: 0,
data: [],
};
});

export const commuteDetailsResponseData3: PlatformApiResponse<CommuteDetailsResponse> = {
export const commuteDetailsResponseData3: PlatformApiResponse<CommuteDetailsResponse> = deepFreeze({
count: 1,
offset: 0,
data: [
Expand All @@ -55,4 +57,4 @@ export const commuteDetailsResponseData3: PlatformApiResponse<CommuteDetailsResp
},
},
],
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/commute-details.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { CommuteDetails } from '../models/platform/v1/commute-details.model';

export const commuteDetailsData: CommuteDetails = {
export const commuteDetailsData: CommuteDetails = deepFreeze({
distance: 10,
distance_unit: 'KM',
id: 12345,
Expand All @@ -20,4 +22,4 @@ export const commuteDetailsData: CommuteDetails = {
state: 'Karnataka',
city: 'Bangalore',
},
};
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { CCCExpFlattened } from '../models/corporate-card-expense-flattened.model';

export const eCCCApiResponse: CCCExpFlattened[] = [
export const eCCCApiResponse: CCCExpFlattened[] = deepFreeze([
{
ccce_id: 'ccceYIJhT8Aj6U',
ccce_created_at: new Date('2021-03-26T09:29:14.586Z'),
Expand Down Expand Up @@ -34,4 +36,4 @@ export const eCCCApiResponse: CCCExpFlattened[] = [
ou_department_id: 'deptpmQ0SsMO0S',
tx_project_id: null,
},
];
]);
18 changes: 10 additions & 8 deletions src/app/core/mock-data/corporate-card-expense-unflattened.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import deepFreeze from 'deep-freeze-strict';

import { CCCExpUnflattened } from '../models/corporate-card-expense-unflattened.model';

export const expectedECccResponse: CCCExpUnflattened[] = [
export const expectedECccResponse: CCCExpUnflattened[] = deepFreeze([
{
ccce: {
id: 'ccceYIJhT8Aj6U',
Expand Down Expand Up @@ -48,27 +50,27 @@ export const expectedECccResponse: CCCExpUnflattened[] = [
transfer_settlement_id: null,
},
},
];
]);

export const eCCCData1: CCCExpUnflattened = {
export const eCCCData1: CCCExpUnflattened = deepFreeze({
...expectedECccResponse[0],
ccce: {
...expectedECccResponse[0].ccce,
corporate_credit_card_account_number: '123456789',
},
flow: 'newCCCFlow',
};
});

export const eCCCData2: CCCExpUnflattened = {
export const eCCCData2: CCCExpUnflattened = deepFreeze({
...expectedECccResponse[0],
ccce: {
...expectedECccResponse[0].ccce,
corporate_credit_card_account_number: '123456789',
vendor: null,
},
};
});

export const eCCCData3: CCCExpUnflattened = {
export const eCCCData3: CCCExpUnflattened = deepFreeze({
...expectedECccResponse[0],
balance: {
transfer_settlement_id: 'setxPixUhOPVL',
Expand All @@ -78,4 +80,4 @@ export const eCCCData3: CCCExpUnflattened = {
...expectedECccResponse[0].ccce,
corporate_credit_card_account_number: '123456789',
},
};
});
6 changes: 4 additions & 2 deletions src/app/core/mock-data/corporate-card-expense.data.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import deepFreeze from 'deep-freeze-strict';

import { ApiV2Response } from '../models/v2/api-v2-response.model';
import { CorporateCardExpense } from '../models/v2/corporate-card-expense.model';

export const corporateCardExpenseData: ApiV2Response<CorporateCardExpense> = {
export const corporateCardExpenseData: ApiV2Response<CorporateCardExpense> = deepFreeze({
count: 0,
data: [],
limit: 0,
offset: 0,
url: '/v2/corporate_card_transactions',
};
});
34 changes: 18 additions & 16 deletions src/app/core/mock-data/corporate-card-trackers.data.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import deepFreeze from 'deep-freeze-strict';

import { CardNetworkType } from '../enums/card-network-type';
import {
CardEnrolledProperties,
Expand All @@ -6,47 +8,47 @@ import {
EnrollingNonRTFCardProperties,
} from '../models/tracking-properties.model';

export const cardEnrolledProperties1: CardEnrolledProperties = {
export const cardEnrolledProperties1: CardEnrolledProperties = deepFreeze({
Source: '/enterprise/manage_corporate_cards',
'Card Network': CardNetworkType.VISA,
'Card ID': 'bacc15bbrRGWzf',
};
});

export const cardEnrolledProperties2: CardEnrolledProperties = {
export const cardEnrolledProperties2: CardEnrolledProperties = deepFreeze({
Source: '/enterprise/manage_corporate_cards',
'Card Network': CardNetworkType.VISA,
'Card ID': 'bacc15bbrRGWzf',
};
});

export const cardUnenrolledProperties: CardUnenrolledProperties = {
export const cardUnenrolledProperties: CardUnenrolledProperties = deepFreeze({
'Card Network': CardNetworkType.VISA,
'Card ID': 'bacc15bbrRGWzf',
};
});

export const cardEnrollmentErrorsProperties1: CardEnrollmentErrorsProperties = {
export const cardEnrollmentErrorsProperties1: CardEnrollmentErrorsProperties = deepFreeze({
'Card Network': CardNetworkType.VISA,
Source: '/enterprise/manage_corporate_cards',
'Error Message': 'This card already exists in the system',
};
});

export const cardEnrollmentErrorsProperties2: CardEnrollmentErrorsProperties = {
export const cardEnrollmentErrorsProperties2: CardEnrollmentErrorsProperties = deepFreeze({
'Card Network': CardNetworkType.VISA,
Source: '/enterprise/manage_corporate_cards',
'Error Message': 'Something went wrong. Please try after some time.',
};
});

export const cardEnrollmentErrorsProperties3: CardEnrollmentErrorsProperties = {
export const cardEnrollmentErrorsProperties3: CardEnrollmentErrorsProperties = deepFreeze({
'Card Network': CardNetworkType.VISA,
Source: '/enterprise/manage_corporate_cards',
'Error Message': 'Invalid card number',
};
});

export const cardEnrollmentErrorsProperties4: CardEnrollmentErrorsProperties = {
export const cardEnrollmentErrorsProperties4: CardEnrollmentErrorsProperties = deepFreeze({
'Card Network': CardNetworkType.VISA,
Source: '/enterprise/manage_corporate_cards',
'Error Message': 'Invalid card network',
};
});

export const enrollingNonRTFCardProperties: EnrollingNonRTFCardProperties = {
export const enrollingNonRTFCardProperties: EnrollingNonRTFCardProperties = deepFreeze({
Source: '/enterprise/manage_corporate_cards',
};
});
Loading

0 comments on commit 37c647c

Please sign in to comment.