From 9f70805fbb75e863c98304db884eb0e64a05f6c0 Mon Sep 17 00:00:00 2001 From: Gauravudia Date: Tue, 27 Feb 2024 15:16:39 +0530 Subject: [PATCH] refactor: address review comments --- src/v0/destinations/branch/utils.js | 4 ++-- src/v0/destinations/branch/utils.test.js | 2 +- test/integrations/destinations/branch/processor/data.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/v0/destinations/branch/utils.js b/src/v0/destinations/branch/utils.js index 007299ba0c..1415f0de39 100644 --- a/src/v0/destinations/branch/utils.js +++ b/src/v0/destinations/branch/utils.js @@ -14,8 +14,8 @@ const getMappedEventNameFromConfig = (message, destination) => { // if event is mapped on dashboard, use the mapped event name if (Array.isArray(eventsMapping) && eventsMapping.length > 0) { - const keyMap = getHashFromArray(eventsMapping, 'from', 'to'); - eventName = keyMap[event.toLowerCase()]; + const keyMap = getHashFromArray(eventsMapping, 'from', 'to', false); + eventName = keyMap[event]; } return eventName; diff --git a/src/v0/destinations/branch/utils.test.js b/src/v0/destinations/branch/utils.test.js index e108445437..e7da007d89 100644 --- a/src/v0/destinations/branch/utils.test.js +++ b/src/v0/destinations/branch/utils.test.js @@ -3,7 +3,7 @@ describe('getMappedEventNameFromConfig', () => { it('should return the mapped event name when it exists in the events mapping configuration', () => { const message = { event: 'Order Completed' }; const destination = { - Config: { eventsMapping: [{ from: 'order completed', to: 'PURCHASE' }] }, + Config: { eventsMapping: [{ from: 'Order Completed', to: 'PURCHASE' }] }, }; const result = getMappedEventNameFromConfig(message, destination); expect(result).toBe('PURCHASE'); diff --git a/test/integrations/destinations/branch/processor/data.ts b/test/integrations/destinations/branch/processor/data.ts index 89ba3b0c08..dc1bdd33bc 100644 --- a/test/integrations/destinations/branch/processor/data.ts +++ b/test/integrations/destinations/branch/processor/data.ts @@ -1561,7 +1561,7 @@ export const data = [ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', }, - event: 'order completed', + event: 'Order Completed', integrations: { All: true, },