From 9549e509e7e84b7c5c41782437ae9ff30d80ed24 Mon Sep 17 00:00:00 2001 From: Anant Jain Date: Tue, 26 Mar 2024 13:16:24 +0530 Subject: [PATCH] fix: validation for event name --- src/v0/destinations/tiktok_ads/transform.js | 5 -- .../destinations/tiktok_ads/processor/data.ts | 56 ------------------- 2 files changed, 61 deletions(-) diff --git a/src/v0/destinations/tiktok_ads/transform.js b/src/v0/destinations/tiktok_ads/transform.js index 4274dcbc5a..17a37984c3 100644 --- a/src/v0/destinations/tiktok_ads/transform.js +++ b/src/v0/destinations/tiktok_ads/transform.js @@ -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`, diff --git a/test/integrations/destinations/tiktok_ads/processor/data.ts b/test/integrations/destinations/tiktok_ads/processor/data.ts index 73a1aa862e..429024b8a9 100644 --- a/test/integrations/destinations/tiktok_ads/processor/data.ts +++ b/test/integrations/destinations/tiktok_ads/processor/data.ts @@ -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',