Skip to content

Commit

Permalink
fix: validation for event name
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Mar 26, 2024
1 parent b2291d5 commit 9549e50
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 61 deletions.
5 changes: 0 additions & 5 deletions src/v0/destinations/tiktok_ads/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,7 @@ const trackResponseBuilder = async (message, { Config }) => {
const { eventsToStandard, sendCustomEvents } = Config;
validateEventName(message.event);
let event = message.event.toLowerCase().trim();
if (!event) {
throw new InstrumentationError('Event name is required');
}

const standardEventsMap = getHashFromArrayWithDuplicate(eventsToStandard);

if (!sendCustomEvents && eventNameMapping[event] === undefined && !standardEventsMap[event]) {
throw new InstrumentationError(
`Event name (${event}) is not valid, must be mapped to one of standard events`,
Expand Down
56 changes: 0 additions & 56 deletions test/integrations/destinations/tiktok_ads/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6069,62 +6069,6 @@ export const data = [
},
},
},
{
name: 'tiktok_ads',
description: 'Test 38-> V2 -> Event name found but include spaces only',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
anonymousId: '21e13f4bc7ceddad',
event: ' ',
channel: 'web',
messageId: '84e26acc-56a5-4835-8233-591137fca468',
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22',
originalTimestamp: '2019-10-14T09:03:17.562Z',
timestamp: '2020-09-17T19:49:27Z',
type: 'track',
integrations: {
All: true,
},
sentAt: '2019-10-14T09:03:22.563Z',
},
destination: {
Config: {
accessToken: 'dummyAccessToken',
pixelCode: '{{PIXEL-CODE}}',
hashUserProperties: false,
version: 'v2',
},
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
statusCode: 400,
error: 'Event name is required',
statTags: {
errorCategory: 'dataValidation',
errorType: 'instrumentation',
destType: 'TIKTOK_ADS',
module: 'destination',
implementation: 'native',
feature: 'processor',
},
},
],
},
},
},
{
name: 'tiktok_ads',
description: 'Test 39-> V2 -> Access Token not found',
Expand Down

0 comments on commit 9549e50

Please sign in to comment.