Skip to content

Commit

Permalink
chore: fix exports, tests, rtflow removed
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed May 28, 2024
1 parent 9462c3d commit b7be265
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 417 deletions.
4 changes: 2 additions & 2 deletions src/cdk/v2/destinations/klaviyo_bulk_upload/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ steps:
.message.type.toLowerCase();
- name: validateInput
template: |
let messageType = $.outputs.messageType;
let messageType = .message.type;
$.assert(messageType, "message Type is not present. Aborting");
$.assert(messageType in {{$.EventType.([.IDENTIFY])}}, "message type " + messageType + " is not supported");
$.assert(.message.type.toLowerCase() ==='identify', "Event type " + .message.type.toLowerCase() + " is not supported. Aborting message.");
$.assertConfig(.destination.Config.privateApiKey, "Private Api Key is not present. Aborting");
- name: generatePayload
Expand Down
53 changes: 0 additions & 53 deletions src/cdk/v2/destinations/klaviyo_bulk_upload/rtWorkflow.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/klaviyo_bulk_upload/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ function combinePayloads(inputs) {
return { ...payload };
}

export { transformSingleMessage, combinePayloads };
module.exports = { transformSingleMessage, combinePayloads };
157 changes: 9 additions & 148 deletions test/integrations/destinations/klaviyo_bulk_upload/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const data = [
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
jobId: 1,
},
},
],
Expand Down Expand Up @@ -94,6 +95,7 @@ export const data = [
ip: '213.5.6.41',
},
anonymous_id: 'user1',
jobIdentifier: 'user1:1',
},
},
],
Expand Down Expand Up @@ -122,6 +124,7 @@ export const data = [
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
jobId: 1,
},
},
],
Expand Down Expand Up @@ -180,6 +183,7 @@ export const data = [
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
jobId: 1,
},
},
],
Expand Down Expand Up @@ -215,6 +219,7 @@ export const data = [
ip: '213.5.6.41',
},
anonymous_id: 'user1',
jobIdentifier: 'user1:1',
},
},
],
Expand Down Expand Up @@ -243,6 +248,7 @@ export const data = [
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
jobId: 1,
},
},
],
Expand Down Expand Up @@ -300,6 +306,7 @@ export const data = [
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
jobId: 1,
},
},
],
Expand Down Expand Up @@ -335,6 +342,7 @@ export const data = [
ip: '213.5.6.41',
},
anonymous_id: 'user1',
jobIdentifier: 'user1:1',
},
},
],
Expand All @@ -353,158 +361,11 @@ export const data = [
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
jobId: 1,
},
},
],
},
},
},
{
name: 'klaviyo_bulk_upload',
description: 'Failed identify event with missing Private Api Key',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
channel: 'sources',
context: {
externalId: [
{
id: 'user1',
identifierType: 'userId',
type: 'KLAVIYO_BULK_UPLOAD-userProfiles',
},
],
mappedToDestination: 'true',
sources: {
job_id: '2gif2bMzsX1Nt0rbV1vcbAE3cxC',
job_run_id: 'cp5p5ilq47pqg38v2nfg',
task_run_id: 'cp5p5ilq47pqg38v2ng0',
version: '2051/merge',
},
},
traits: {
email: '[email protected]',
first_name: 'Testqwe0022',
last_name: 'user',
phone_number: '+919902330123',
ip: '213.5.6.41',
},
type: 'identify',
userId: '1',
},
destination: {
DestinationDefinition: {
Config: {
cdkV2Enabled: true,
},
},
Config: {
privateApiKey: '',
listId: 'list101',
},
},
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
},
},
],
},
},
output: {
metadata: {
jobId: 1,
},
statusCode: 400,
error:
'Private Api Key is not present. Aborting: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: Private Api Key is not present. Aborting',
statTags: {
errorCategory: 'dataValidation',
errorType: 'configuration',
implementation: 'cdkV2',
destType: 'KLAVIYO_BULK_UPLOAD',
module: 'destination',
feature: 'processor',
},
},
},
{
name: 'klaviyo_bulk_upload',
description: 'Failed event with invalid event type',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
channel: 'sources',
context: {
externalId: [
{
id: 'user1',
identifierType: 'userId',
type: 'KLAVIYO_BULK_UPLOAD-userProfiles',
},
],
mappedToDestination: 'true',
sources: {
job_id: '2gif2bMzsX1Nt0rbV1vcbAE3cxC',
job_run_id: 'cp5p5ilq47pqg38v2nfg',
task_run_id: 'cp5p5ilq47pqg38v2ng0',
version: '2051/merge',
},
},
traits: {
email: '[email protected]',
first_name: 'Testqwe0022',
last_name: 'user',
phone_number: '+919902330123',
ip: '213.5.6.41',
},
type: 'identify',
userId: '1',
},
destination: {
DestinationDefinition: {
Config: {
cdkV2Enabled: true,
},
},
Config: {
privateApiKey: 'pk_dummy_123',
listId: 'list101',
},
},
metadata: {
destinationId: 'destId',
workspaceId: 'wspId',
},
},
],
},
},
output: {
metadata: {
jobId: 1,
},
statusCode: 400,
error:
'message type track is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type track is not supported',
statTags: {
errorCategory: 'dataValidation',
errorType: 'instrumentation',
implementation: 'cdkV2',
destType: 'KLAVIYO_BULK_UPLOAD',
module: 'destination',
feature: 'processor',
},
},
},
];
Loading

0 comments on commit b7be265

Please sign in to comment.