Skip to content

Commit

Permalink
Merge branch 'develop' into fix.hs
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 authored Jan 18, 2024
2 parents 00b8388 + e53b304 commit a799ecb
Show file tree
Hide file tree
Showing 8 changed files with 2,483 additions and 3,432 deletions.
412 changes: 412 additions & 0 deletions src/controllers/util/index.test.ts

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@
"THE_TRADE_DESK": true,
"INTERCOM": true
},
"regulations": [
"BRAZE",
"AM",
"INTERCOM",
"CLEVERTAP",
"AF",
"MP",
"GA",
"ITERABLE",
"ENGAGE",
"CUSTIFY",
"SENDGRID",
"SPRIG"
],
"supportSourceTransformV1": true,
"supportTransformerProxyV1": false
}
4 changes: 3 additions & 1 deletion src/v0/destinations/mp/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ const processSingleMessage = (message, destination) => {
return processIdentifyEvents(clonedMessage, clonedMessage.type, destination);
case EventType.ALIAS:
if (destination.Config?.identityMergeApi === 'simplified') {
throw new InstrumentationError('Alias call is deprecated in `Simplified ID merge`');
throw new InstrumentationError(
'The use of the alias call in the context of the `Simplified ID merge` feature is not supported anymore.',
);
}
return processAliasEvents(message, message.type, destination);
case EventType.GROUP:
Expand Down
4 changes: 2 additions & 2 deletions src/v0/destinations/slack/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ const buildDefaultTraitTemplate = (traitsList, traits, template) => {
let generatedStringFromTemplate = template;
// build template with whitelisted traits
traitsList.forEach((trait) => {
generatedStringFromTemplate += `${trait}: {{${trait}}} `;
generatedStringFromTemplate += `${trait}: {{"${trait}"}} `;
});
// else with all traits
if (traitsList.length === 0) {
Object.keys(traits).forEach((traitKey) => {
generatedStringFromTemplate += `${traitKey}: {{${traitKey}}} `;
generatedStringFromTemplate += `${traitKey}: {{"${traitKey}"}} `;
});
}
return generatedStringFromTemplate;
Expand Down
32 changes: 31 additions & 1 deletion test/apitests/service.api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const getDataFromPath = (pathInput) => {
return JSON.parse(testDataFile.toString());
};

describe('Basic route tests', () => {
describe('features tests', () => {
test('successful features response', async () => {
const expectedData = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../../src/features.json'), 'utf8'),
Expand All @@ -44,6 +44,36 @@ describe('Basic route tests', () => {
expect(response.status).toEqual(200);
expect(JSON.parse(response.text)).toEqual(expectedData);
});

test('features regulations should be array', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const regulations = JSON.parse(response.text).regulations;
expect(Array.isArray(regulations)).toBeTruthy();
});

test('features routerTransform should be object', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const routerTransform = JSON.parse(response.text).routerTransform;
expect(Array.isArray(routerTransform)).toBeFalsy();
expect(typeof routerTransform).toBe('object');
expect(Object.keys(routerTransform).length).toBeGreaterThan(0);
});

test('features supportSourceTransformV1 to be boolean', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const supportSourceTransformV1 = JSON.parse(response.text).supportSourceTransformV1;
expect(typeof supportSourceTransformV1).toBe('boolean');
});

test('features supportTransformerProxyV1 to be boolean', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const supportTransformerProxyV1 = JSON.parse(response.text).supportTransformerProxyV1;
expect(typeof supportTransformerProxyV1).toBe('boolean');
});
});

describe('Destination api tests', () => {
Expand Down
Loading

0 comments on commit a799ecb

Please sign in to comment.