Skip to content

Commit

Permalink
chore: comments addressed+2
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Nov 1, 2023
1 parent ce4d07b commit c2c5001
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/v0/destinations/am/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,9 @@ const processSingleMessage = (message, destination) => {
.trim()
.replaceAll(/{{([^{}]+)}}/g, get(message, getMessagePath));
} else {
evType = `Viewed ${name || get(message, CATEGORY_KEY) || ''} Page`;
const updatedName =
name || get(message, CATEGORY_KEY) ? `${name || get(message, CATEGORY_KEY)} ` : undefined;
evType = `Viewed ${updatedName || ''}Page`;
}

message.properties = {
Expand Down
4 changes: 1 addition & 3 deletions test/__tests__/data/am_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -4824,7 +4824,6 @@
"search": "",
"title": "",
"url": "https://docs.rudderstack.com/destinations/amplitude",
"category": "destination",
"initial_referrer": "https://docs.rudderstack.com",
"initial_referring_domain": "docs.rudderstack.com"
},
Expand All @@ -4834,13 +4833,12 @@
"event_id": 2
}
},
"name": "ApplicationLoaded",
"sentAt": "2019-10-14T11:15:53.296Z"
},
"destination": {
"Config": {
"apiKey": "abcde",
"useUserDefinedPageEventName": true,
"useUserDefinedPageEventName": false,
"userProvidedPageEventString": "Viewed {{context.page.title}} event."
}
}
Expand Down
9 changes: 3 additions & 6 deletions test/__tests__/data/am_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -3937,8 +3937,7 @@
"app_version": "1.2",
"platform": "Android",
"language": "en-US",
"event_properties": {
},
"event_properties": {},
"insert_id": "1662393883248-509420bf-b812-4f8d-bdb2-8c811bfde87f",
"user_properties": {
"anonymousId": "5d205961641ee6c5",
Expand Down Expand Up @@ -4277,17 +4276,15 @@
"app_name": "RudderLabs JavaScript SDK",
"app_version": "1.0.0",
"language": "en-US",
"event_type": "Viewed Home Page event.",
"event_type": "Viewed Page",
"event_properties": {
"path": "/destinations/amplitude",
"referrer": "",
"search": "",
"title": "",
"url": "https://docs.rudderstack.com/destinations/amplitude",
"category": "destination",
"initial_referrer": "https://docs.rudderstack.com",
"initial_referring_domain": "docs.rudderstack.com",
"name": "ApplicationLoaded"
"initial_referring_domain": "docs.rudderstack.com"
},
"session_id": -1,
"insert_id": "5e10d13a-bf9a-44bf-b884-43a9e591ea71",
Expand Down

0 comments on commit c2c5001

Please sign in to comment.