diff --git a/src/v0/destinations/am/util.test.js b/src/v0/destinations/am/util.test.js index 455f9117ef..fa30a74757 100644 --- a/src/v0/destinations/am/util.test.js +++ b/src/v0/destinations/am/util.test.js @@ -65,9 +65,7 @@ describe('getUnsetObj', () => { }); }); - describe('validateEventType', () => { - it('should validate event type when it is valid with only page name given', () => { expect(() => { validateEventType('Home Page'); @@ -77,21 +75,25 @@ describe('validateEventType', () => { it('should throw an error when event type is null', () => { expect(() => { validateEventType(null); - }).toThrow('Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`'); + }).toThrow( + 'Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`', + ); }); it('should throw an error when event type is undefined', () => { expect(() => { validateEventType(undefined); - }).toThrow('Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`'); + }).toThrow( + 'Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`', + ); }); // Function receives an empty string as event type it('should throw an error when event type is an empty string', () => { expect(() => { validateEventType(''); - }).toThrow('Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`'); + }).toThrow( + 'Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`', + ); }); - }); - diff --git a/src/v0/destinations/am/utils.js b/src/v0/destinations/am/utils.js index e51d09aaa7..ed1b772fca 100644 --- a/src/v0/destinations/am/utils.js +++ b/src/v0/destinations/am/utils.js @@ -111,16 +111,16 @@ const getUnsetObj = (message) => { }; /** - * Check for evType as in some cases, like when the page name is absent, + * Check for evType as in some cases, like when the page name is absent, * either the template depends only on the event.name or there is no template provided by user - * @param {*} evType + * @param {*} evType */ const validateEventType = (evType) => { - if (!isDefinedAndNotNull(evType) || (typeof evType === "string" && evType.length ===0)) { - throw new InstrumentationError( - 'Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`', - ); - } + if (!isDefinedAndNotNull(evType) || (typeof evType === 'string' && evType.length === 0)) { + throw new InstrumentationError( + 'Event type is missing. Please send it under `event.type`. For page/screen events, send it under `event.name`', + ); + } }; module.exports = { getOSName, @@ -131,5 +131,5 @@ module.exports = { getBrand, getEventId, getUnsetObj, - validateEventType + validateEventType, }; diff --git a/src/v0/destinations/tiktok_ads_offline_events/config.js b/src/v0/destinations/tiktok_ads_offline_events/config.js index 3c58b42a44..4bb3bda850 100644 --- a/src/v0/destinations/tiktok_ads_offline_events/config.js +++ b/src/v0/destinations/tiktok_ads_offline_events/config.js @@ -19,23 +19,23 @@ const CONFIG_CATEGORIES = { const PARTNER_NAME = 'RudderStack'; const EVENT_NAME_MAPPING = { - 'addpaymentinfo': 'AddPaymentInfo', - 'addtocart': 'AddToCart', - 'addtowishlist': 'AddToWishlist', + addpaymentinfo: 'AddPaymentInfo', + addtocart: 'AddToCart', + addtowishlist: 'AddToWishlist', 'checkout started': 'InitiateCheckout', 'checkout step completed': 'CompletePayment', - 'clickbutton': 'ClickButton', - 'completeregistration': 'CompleteRegistration', - 'contact': 'Contact', - 'download': 'Download', + clickbutton: 'ClickButton', + completeregistration: 'CompleteRegistration', + contact: 'Contact', + download: 'Download', 'order completed': 'PlaceAnOrder', 'payment info entered': 'AddPaymentInfo', 'product added': 'AddToCart', 'product added to wishlist': 'AddToWishlist', - 'search': 'Search', - 'submitform': 'SubmitForm', - 'subscribe': 'Subscribe', - 'viewcontent': 'ViewContent', + search: 'Search', + submitform: 'SubmitForm', + subscribe: 'Subscribe', + viewcontent: 'ViewContent', }; const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);