Skip to content

Commit

Permalink
chore: refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikas Venkatraman authored and Vikas Venkatraman committed Jun 4, 2024
1 parent 5263566 commit be23c39
Show file tree
Hide file tree
Showing 5 changed files with 808 additions and 994 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { Destination, RouterTransformationRequest } from '../../../../../src/types';
import { generateMetadata } from '../../../testUtils';

const destination: Destination = {
Config: {
accessToken: 'ABC',
disableFormat: false,
isHashRequired: true,
isRaw: false,
maxUserCount: '50',
oneTrustCookieCategories: [],
skipVerify: false,
subType: 'NA',
type: 'NA',
userSchema: ['EMAIL'],
},
ID: '1mMy5cqbtfuaKZv1IhVQKnBdVwe',
Name: 'FB_CUSTOM_AUDIENCE',
Enabled: true,
WorkspaceID: '1TSN08muJTZwH8iCDmnnRt1pmLd',
DestinationDefinition: {
ID: '1aIXqM806xAVm92nx07YwKbRrO9',
Name: 'FB_CUSTOM_AUDIENCE',
DisplayName: 'FB_CUSTOM_AUDIENCE',
Config: {},
},
Transformations: [],
IsConnectionEnabled: true,
IsProcessorEnabled: true,
};

export const rETLAudienceRouterRequest: RouterTransformationRequest = {
input: [
{
message: {
sentAt: '2023-03-30 06:42:55.991938402 +0000 UTC',
userId: '2MUWghI7u85n91dd1qzGyswpZan-2MUWqbQqvctyfMGqU9QCNadpKNy',
channel: 'sources',
messageId: '4d906837-031d-4d34-b97a-62fdf51b4d3a',
event: 'Add_Audience',
context: {
destinationFields: 'EMAIL, FN',
externalId: [{ type: 'FB_CUSTOM_AUDIENCE-23848494844100489', identifierType: 'EMAIL' }],
mappedToDestination: 'true',
sources: {
job_run_id: 'cgiiurt8um7k7n5dq480',
task_run_id: 'cgiiurt8um7k7n5dq48g',
job_id: '2MUWghI7u85n91dd1qzGyswpZan',
version: '895/merge',
},
},
recordId: '725ad989-6750-4839-b46b-0ddb3b8e5aa2/1/10',
rudderId: '85c49666-c628-4835-937b-8f1d9ee7a724',
properties: {
listData: {
add: [
{ EMAIL: '[email protected]', FN: 'vishwa' },
{ EMAIL: '[email protected]', FN: 'hskks' },
{ EMAIL: '[email protected]', FN: 'ghfry' },
{ EMAIL: '[email protected]', FN: 'hbcwqe' },
{ EMAIL: '[email protected]', FN: 'dsfds' },
{ EMAIL: 'ascscxsaca@com', FN: 'scadscdvcda' },
{ EMAIL: '[email protected]', FN: 'subscribed' },
{ EMAIL: '[email protected]', FN: 'subscribed' },
{ EMAIL: '[email protected]', FN: 'pending' },
{ EMAIL: '[email protected]', FN: 'pending' },
],
},
},
type: 'audienceList',
anonymousId: '63228b51-394e-4ca2-97a0-427f6187480b',
},
destination: destination,
metadata: generateMetadata(3),
},
{
message: {
sentAt: '2023-03-30 06:42:55.991938402 +0000 UTC',
userId: '2MUWghI7u85n91dd1qzGyswpZan-2MUWqbQqvctyfMGqU9QCNadpKNy',
channel: 'sources',
messageId: '4d906837-031d-4d34-b97a-62fdf51b4d3a',
event: 'Add_Audience',
context: {
externalId: [{ type: 'FB_CUSTOM_AUDIENCE-23848494844100489', identifierType: 'EMAIL' }],
mappedToDestination: 'true',
sources: {
job_run_id: 'cgiiurt8um7k7n5dq480',
task_run_id: 'cgiiurt8um7k7n5dq48g',
job_id: '2MUWghI7u85n91dd1qzGyswpZan',
version: '895/merge',
},
},
recordId: '725ad989-6750-4839-b46b-0ddb3b8e5aa2/1/10',
rudderId: '85c49666-c628-4835-937b-8f1d9ee7a724',
properties: {
listData: {
add: [
{ EMAIL: '[email protected]', FN: 'vishwa' },
{ EMAIL: '[email protected]', FN: 'hskks' },
{ EMAIL: '[email protected]', FN: 'ghfry' },
{ EMAIL: '[email protected]', FN: 'hbcwqe' },
{ EMAIL: '[email protected]', FN: 'dsfds' },
{ EMAIL: 'ascscxsaca@com', FN: 'scadscdvcda' },
{ EMAIL: '[email protected]', FN: 'subscribed' },
{ EMAIL: '[email protected]', FN: 'subscribed' },
{ EMAIL: '[email protected]', FN: 'pending' },
{ EMAIL: '[email protected]', FN: 'pending' },
],
},
},
type: 'audienceList',
anonymousId: '63228b51-394e-4ca2-97a0-427f6187480b',
},
destination: destination,
metadata: generateMetadata(4),
},
],
destType: 'fb_custom_audience',
};

module.exports = {
rETLAudienceRouterRequest,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { Destination, RouterTransformationRequest } from '../../../../../src/types';
import { generateMetadata } from '../../../testUtils';

const destination: Destination = {
Config: {
accessToken: 'ABC',
disableFormat: false,
isHashRequired: true,
isRaw: false,
maxUserCount: '2',
oneTrustCookieCategories: [],
skipVerify: false,
subType: 'NA',
type: 'NA',
userSchema: ['EMAIL'],
},
ID: '1mMy5cqbtfuaKZv1IhVQKnBdVwe',
Name: 'FB_CUSTOM_AUDIENCE',
Enabled: true,
WorkspaceID: '1TSN08muJTZwH8iCDmnnRt1pmLd',
DestinationDefinition: {
ID: '1aIXqM806xAVm92nx07YwKbRrO9',
Name: 'FB_CUSTOM_AUDIENCE',
DisplayName: 'FB_CUSTOM_AUDIENCE',
Config: {},
},
Transformations: [],
IsConnectionEnabled: true,
IsProcessorEnabled: true,
};

export const rETLBatchingRouterRequest: RouterTransformationRequest = {
input: [
{
destination: destination,
message: {
action: 'insert',
context: {
destinationFields: 'EMAIL, FI',
externalId: [
{
type: 'FB_CUSTOM_AUDIENCE-23848494844100489',
identifierType: 'EMAIL',
},
],
mappedToDestination: 'true',
sources: {
job_run_id: 'cgiiurt8um7k7n5dq480',
task_run_id: 'cgiiurt8um7k7n5dq48g',
job_id: '2MUWghI7u85n91dd1qzGyswpZan',
version: '895/merge',
},
},
recordId: '2',
rudderId: '2',
fields: {
EMAIL: '[email protected]',
FI: 'ghui',
},
type: 'record',
},
metadata: generateMetadata(1),
},
{
destination: destination,
message: {
action: 'insert',
context: {
destinationFields: 'EMAIL, FI',
externalId: [
{
type: 'FB_CUSTOM_AUDIENCE-23848494844100489',
identifierType: 'EMAIL',
},
],
mappedToDestination: 'true',
sources: {
job_run_id: 'cgiiurt8um7k7n5dq480',
task_run_id: 'cgiiurt8um7k7n5dq48g',
job_id: '2MUWghI7u85n91dd1qzGyswpZan',
version: '895/merge',
},
},
recordId: '2',
rudderId: '2',
fields: {
EMAIL: '[email protected]',
FI: 'ghui',
},
type: 'record',
},
metadata: generateMetadata(2),
},
{
destination: destination,
message: {
action: 'insert',
context: {
destinationFields: 'EMAIL, FI',
externalId: [
{
type: 'FB_CUSTOM_AUDIENCE-23848494844100489',
identifierType: 'EMAIL',
},
],
mappedToDestination: 'true',
sources: {
job_run_id: 'cgiiurt8um7k7n5dq480',
task_run_id: 'cgiiurt8um7k7n5dq48g',
job_id: '2MUWghI7u85n91dd1qzGyswpZan',
version: '895/merge',
},
},
recordId: '2',
rudderId: '2',
fields: {
EMAIL: '[email protected]',
FI: 'ghui',
},
type: 'record',
},
metadata: generateMetadata(3),
},
],
destType: 'fb_custom_audience',
};

module.exports = {
rETLBatchingRouterRequest,
};
Loading

0 comments on commit be23c39

Please sign in to comment.