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

chore: editing unit test case and removing unnecessary component test for emarsys #3429

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 9 additions & 0 deletions src/cdk/v2/destinations/emarsys/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,5 +539,14 @@ describe('Emarsys utils', () => {
'validEvent is not mapped to any Emersys external event. Aborting',
);
});

// When eventsMapping is undefined, the function should throw a TypeError.
it('should throw a TypeError when eventsMapping is not an array', () => {
const message = { event: 'validEvent' };
const destConfig = { eventsMapping: undefined };
expect(() => deduceEventId(message, destConfig)).toThrow(
'validEvent is not mapped to any Emersys external event. Aborting',
);
});
});
});
117 changes: 0 additions & 117 deletions test/integrations/destinations/emarsys/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1377,121 +1377,4 @@ export const data = [
},
},
},
{
name: 'emarsys',
description: 'Test 11 : Track call with no event mapping field should fail',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
metadata: {},
message: {
event: 'Order Completed',
anonymousId: 'anonId06',
channel: 'web',
context: {
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36',
traits: {
email: '[email protected]',
lastName: 'Doe',
firstName: 'John',
},
},
integrations: {
All: true,
EMARSYS: {
trigger_id: 'EVENT_TRIGGER_ID',
},
},
properties: {
company: 'testComp',
data: {
section_group1: [
{
section_variable1: 'some_value',
section_variable2: 'another_value',
},
{
section_variable1: 'yet_another_value',
section_variable2: 'one_more_value',
},
],
global: {
global_variable1: 'global_value',
global_variable2: 'another_global_value',
},
},
attachment: [
{
filename: 'example.pdf',
data: 'ZXhhbXBsZQo=',
},
],
},
messageId: '2536eda4-d638-4c93-8014-8ffe3f083214',
originalTimestamp: '2020-01-24T06:29:02.362Z',
receivedAt: '2020-01-24T11:59:02.403+05:30',
request_ip: '[::1]:53709',
sentAt: '2020-01-24T06:29:02.363Z',
timestamp: '2023-07-06T11:59:02.402+05:30',
type: 'track',
userId: 'userId06',
},
destination: {
DestinationDefinition: {
Config: {
cdkV2Enabled: true,
excludeKeys: [],
includeKeys: [],
},
},
Config: {
discardEmptyProperties: true,
emersysUsername: 'dummy',
emersysUserSecret: 'dummy',
emersysCustomIdentifier: '3',
defaultContactList: 'dummy',
fieldMapping: [
{
rudderProperty: 'email',
emersysProperty: '3',
},
],
oneTrustCookieCategories: [
{
oneTrustCookieCategory: 'Marketing',
},
],
},
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
error:
'Order Completed is not mapped to any Emersys external event. Aborting: Workflow: procWorkflow, Step: preparePayloadForTrack, ChildStep: undefined, OriginalError: Order Completed is not mapped to any Emersys external event. Aborting',
metadata: {},
statTags: {
destType: 'EMARSYS',
errorCategory: 'dataValidation',
errorType: 'configuration',
feature: 'processor',
implementation: 'cdkV2',
module: 'destination',
},
statusCode: 400,
},
],
},
},
},
].map((d) => ({ ...d, mockFns }));
Loading