Skip to content

Commit

Permalink
refactor: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauravudia committed Feb 27, 2024
1 parent be73abe commit 9f70805
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/v0/destinations/branch/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/branch/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/integrations/destinations/branch/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 9f70805

Please sign in to comment.