From 6e89cd3f67ea887ba17c1cd5ffbca6675f54d96c Mon Sep 17 00:00:00 2001
From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com>
Date: Mon, 6 Nov 2023 12:55:19 +0530
Subject: [PATCH] fix: add check to remove null and undefined properties before
sending (#2796)
* fix: add check to remove null and undefined properties before sending
* chore: fix test
---
src/v0/destinations/adobe_analytics/transform.js | 3 ++-
test/__tests__/data/adobe_analytics.json | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/v0/destinations/adobe_analytics/transform.js b/src/v0/destinations/adobe_analytics/transform.js
index 54806bf578..67bb66310a 100644
--- a/src/v0/destinations/adobe_analytics/transform.js
+++ b/src/v0/destinations/adobe_analytics/transform.js
@@ -11,6 +11,7 @@ const {
isDefinedAndNotNull,
isDefinedAndNotNullAndNotEmpty,
getIntegrationsObj,
+ removeUndefinedAndNullValues,
simpleProcessRouterDest,
} = require('../../util');
const {
@@ -394,7 +395,7 @@ const handleTrack = (message, destinationConfig) => {
break;
}
- return payload;
+ return removeUndefinedAndNullValues(payload);
};
const process = async (event) => {
diff --git a/test/__tests__/data/adobe_analytics.json b/test/__tests__/data/adobe_analytics.json
index cfffccb8da..6361f92640 100644
--- a/test/__tests__/data/adobe_analytics.json
+++ b/test/__tests__/data/adobe_analytics.json
@@ -1010,7 +1010,6 @@
},
"messageId": "1578564113557-af022c68-429e-4af4-b99b-2b9174056383",
"properties": {
- "order_id": "1234",
"affiliation": "Apple Store",
"value": 20,
"revenue": 15.0,
@@ -1019,6 +1018,7 @@
"discount": 1.5,
"coupon": "ImagePro",
"currency": "USD",
+ "purchaseId": "p101",
"products": [
{
"product_id": "123",
@@ -1205,7 +1205,7 @@
"JSON": {},
"JSON_ARRAY": {},
"XML": {
- "payload": "17941080sales campaignwebUSD127.0.0.1en-US12341234Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)https://www.google.com/search?q=estore+bestsellerroottval001RudderLabs JavaScript SDKocheckout startedhttps://www.estore.com/best-seller/12020-01-09T10:01:53.558Zmktcloudid001scCheckoutGames;Monopoly;1;14.00,Games;UNO;2;6.90footlockerrudderstackpoc"
+ "payload": "17941080sales campaignwebUSD127.0.0.1en-USDalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)https://www.google.com/search?q=estore+bestsellerroottval001RudderLabs JavaScript SDKocheckout startedhttps://www.estore.com/best-seller/12020-01-09T10:01:53.558Zmktcloudid001p101scCheckoutGames;Monopoly;1;14.00,Games;UNO;2;6.90footlockerrudderstackpoc"
},
"FORM": {}
},