Skip to content

Commit

Permalink
chore(INT-562): update component test suite (#2744)
Browse files Browse the repository at this point in the history
* component tests(chore): update component test data

* componentTestSuite(chore): remove unwanted files

* chore: clean-up un-used tests

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: clean-up vero tests

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: snapchat tests, remove unnecessary tests for snapchat
- remove ts-ignore for attentive_tag processor tests

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: data-delivery component tests for salesforce

* fix: remove salesforce from original proxy tests & correct the migrated transformation tests

Signed-off-by: Sai Sankeerth <[email protected]>

* migrate marketo-proxy tests to component tests

* chore: migrating intercom, braze, marketo_static_list, snapchat_custom_audience, fb, fbpixel, clevertap, criteo_audience

* fix: move tiktok_ads data-delivery tests to component test suite

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: mock clone

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: decreasing the code-coverage to 75%

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: moving am to component test suite to cover generic handler tests

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: remove proxy.test

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: clean-up braze mocks, un-comment twitter_ads processor test-cases

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: add router component tests for tiktok offline events

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: salesforce router test-case format for router component tests

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: tiktok_ads router test-case format in component tests

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: vero, splitio router test-case format in component tests

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: move back threshold for coverage to 80

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: move threshold for coverage to 75

Signed-off-by: Sai Sankeerth <[email protected]>

* chore: updated test case descriptions

---------

Signed-off-by: Sai Sankeerth <[email protected]>
Co-authored-by: Sai Sankeerth <[email protected]>
Co-authored-by: Utsab Chowdhury <[email protected]>
Co-authored-by: krishnachaitanya <[email protected]>
  • Loading branch information
4 people authored Oct 30, 2023
1 parent 9be5740 commit 3387cb0
Show file tree
Hide file tree
Showing 149 changed files with 65,567 additions and 53,926 deletions.
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module.exports = {
coverageThreshold: {
global: {
branches: 60,
functions: 80,
lines: 80,
statements: 80,
functions: 75,
lines: 75,
statements: 75,
},
},

Expand Down
6 changes: 3 additions & 3 deletions jest.default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module.exports = {
coverageThreshold: {
global: {
branches: 60,
functions: 80,
lines: 80,
statements: 80,
functions: 75,
lines: 75,
statements: 75,
},
},

Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/clevertap/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ const processRouterDest = (inputs, reqMetadata) => {
batchedEvents.forEach((batch) => {
const batchedRequest = generateClevertapBatchedPayload(batch.events, batch.destination);
batchResponseList.push(
getSuccessRespEvents(batchedRequest, batch.metadata, batch.destination)
getSuccessRespEvents(batchedRequest, batch.metadata, batch.destination),
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/hs/HSTransform-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const processLegacyIdentify = async (message, destination, propertyMap) => {
)}/${hsSearchId}`;
response.method = defaultPatchRequestConfig.requestMethod;
}

traits = await populateTraits(propertyMap, traits, destination);
response.body.JSON = removeUndefinedAndNullValues({ properties: traits });
response.source = 'rETL';
Expand Down
38 changes: 20 additions & 18 deletions src/v0/destinations/hs/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,16 @@ const validatePayloadDataTypes = (propertyMap, hsSupportedKey, value, traitsKey)

if (propertyMap[hsSupportedKey] === 'bool' && typeof propValue === 'object') {
throw new InstrumentationError(
`Property ${traitsKey} data type ${typeof propValue} is not matching with Hubspot property data type ${propertyMap[hsSupportedKey]
`Property ${traitsKey} data type ${typeof propValue} is not matching with Hubspot property data type ${
propertyMap[hsSupportedKey]
}`,
);
}

if (propertyMap[hsSupportedKey] === 'number' && typeof propValue !== 'number') {
throw new InstrumentationError(
`Property ${traitsKey} data type ${typeof propValue} is not matching with Hubspot property data type ${propertyMap[hsSupportedKey]
`Property ${traitsKey} data type ${typeof propValue} is not matching with Hubspot property data type ${
propertyMap[hsSupportedKey]
}`,
);
}
Expand All @@ -175,15 +177,15 @@ const validatePayloadDataTypes = (propertyMap, hsSupportedKey, value, traitsKey)

/**
* Converts date to UTC Midnight TimeStamp
* @param {*} propValue
* @returns
* @param {*} propValue
* @returns
*/
const getUTCMidnightTimeStampValue = (propValue) => {
const time = propValue;
const date = new Date(time);
date.setUTCHours(0, 0, 0, 0);
return date.getTime();
}
};

/**
* add addtional properties in the payload that is provided in traits
Expand Down Expand Up @@ -532,15 +534,15 @@ const getExistingData = async (inputs, destination) => {
searchResponse =
Config.authorizationType === 'newPrivateAppApi'
? await httpPOST(url, requestData, requestOptions, {
destType: 'hs',
feature: 'transformation',
endpointPath,
})
destType: 'hs',
feature: 'transformation',
endpointPath,
})
: await httpPOST(url, requestData, {
destType: 'hs',
feature: 'transformation',
endpointPath,
});
destType: 'hs',
feature: 'transformation',
endpointPath,
});
searchResponse = processAxiosResponse(searchResponse);

if (searchResponse.status !== 200) {
Expand Down Expand Up @@ -637,9 +639,9 @@ const getHsSearchId = (message) => {

/**
* returns updated traits
* @param {*} propertyMap
* @param {*} traits
* @param {*} destination
* @param {*} propertyMap
* @param {*} traits
* @param {*} destination
*/
const populateTraits = async (propertyMap, traits, destination) => {
const populatedTraits = traits;
Expand All @@ -655,10 +657,10 @@ const populateTraits = async (propertyMap, traits, destination) => {
if (propertyToTypeMap[key] === 'date') {
populatedTraits[key] = getUTCMidnightTimeStampValue(value);
}
})
});

return populatedTraits;
}
};

module.exports = {
validateDestinationConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/redis/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const process = (event) => {
const messageType = message && message.type && message.type.toLowerCase();

if (messageType !== EventType.IDENTIFY) {
return [];
throw new InstrumentationError('Only Identify calls are supported');
}

if (isEmpty(message.userId)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
[
{
"destKey": "description",
"sourceKeys": "properties.description",
"required": false
},
{
"destKey": "brands",
"sourceKeys": "properties.brands",
"required": false,
"metadata": {
"type": "IsArray"
}
},
{
"destKey": "event_tag",
"sourceKeys": "properties.event_tag",
"required": false
},
{
"destKey": "click_id",
"sourceKeys": "properties.click_id",
"required": false
},
{
"destKey": "level",
"sourceKeys": "properties.level",
"required": false
},
{
"destKey": "uuid_c1",
"sourceKeys": "properties.uuid_c1",
"required": false
},
{
"destKey": "customer_status",
"sourceKeys": "properties.customer_status",
"required": false
},
{
"destKey": "data",
"sourceKeys": "properties.data",
"required": false
},
{
"destKey": "att_status",
"sourceKeys": "properties.att_status",
"required": false
},
{
"destKey": "sign_up_method",
"sourceKeys": "properties.sign_up_method",
"required": false
},
{
"destKey": "advertiser_cookie_1",
"sourceKeys": "properties.advertiser_cookie_1",
"required": false
},
{
"destKey": "delivery_method",
"sourceKeys": "properties.delivery_method",
"required": false
},
{
"sourceKeys": "context.device.model",
"destKey": "device_model",
"required": false
},
{
"sourceKeys": "country",
"destKey": "country",
"sourceFromGenericMap": true,
"required": false
},
{
"sourceKeys": "region",
"destKey": "region",
"sourceFromGenericMap": true,
"required": false
},
{
"sourceKeys": "context.userAgent",
"destKey": "user_agent",
"metadata": {
"type": "toLower"
},
"required": false
{
"destKey": "description",
"sourceKeys": "properties.description",
"required": false
},
{
"destKey": "brands",
"sourceKeys": "properties.brands",
"required": false,
"metadata": {
"type": "IsArray"
}
]
},
{
"destKey": "event_tag",
"sourceKeys": "properties.event_tag",
"required": false
},
{
"destKey": "click_id",
"sourceKeys": "properties.click_id",
"required": false
},
{
"destKey": "level",
"sourceKeys": "properties.level",
"required": false
},
{
"destKey": "uuid_c1",
"sourceKeys": "properties.uuid_c1",
"required": false
},
{
"destKey": "customer_status",
"sourceKeys": "properties.customer_status",
"required": false
},
{
"destKey": "data",
"sourceKeys": "properties.data",
"required": false
},
{
"destKey": "att_status",
"sourceKeys": "properties.att_status",
"required": false
},
{
"destKey": "sign_up_method",
"sourceKeys": "properties.sign_up_method",
"required": false
},
{
"destKey": "advertiser_cookie_1",
"sourceKeys": "properties.advertiser_cookie_1",
"required": false
},
{
"destKey": "delivery_method",
"sourceKeys": "properties.delivery_method",
"required": false
},
{
"sourceKeys": "context.device.model",
"destKey": "device_model",
"required": false
},
{
"sourceKeys": "country",
"destKey": "country",
"sourceFromGenericMap": true,
"required": false
},
{
"sourceKeys": "region",
"destKey": "region",
"sourceFromGenericMap": true,
"required": false
},
{
"sourceKeys": "context.userAgent",
"destKey": "user_agent",
"metadata": {
"type": "toLower"
},
"required": false
}
]
2 changes: 1 addition & 1 deletion src/v0/destinations/snapchat_conversion/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,4 @@ const processRouterDest = async (inputs, reqMetadata) => {
return [...batchResponseList, ...errorRespList];
};

module.exports = { process, processRouterDest };
module.exports = { process, processRouterDest };
Loading

0 comments on commit 3387cb0

Please sign in to comment.