From 4a99205a8bd9c0740372797452bbb744fb0efa16 Mon Sep 17 00:00:00 2001 From: Utsab Chowdhury Date: Fri, 15 Dec 2023 13:18:23 +0530 Subject: [PATCH] fix: braze dedup add test case for non billable attributes --- src/v0/destinations/braze/braze.util.test.js | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/v0/destinations/braze/braze.util.test.js b/src/v0/destinations/braze/braze.util.test.js index a6f3b4d1dec..9e82a235f11 100644 --- a/src/v0/destinations/braze/braze.util.test.js +++ b/src/v0/destinations/braze/braze.util.test.js @@ -694,6 +694,44 @@ describe('dedup utility tests', () => { }); }); + test('deduplicates user data correctly 2', () => { + const userData = { + external_id: '123', + color: 'green', + age: 30, + gender: 'male', + language: 'en', + email_subscribe: true, + push_subscribe: false, + subscription_groups: ['group1', 'group2'], + }; + const storeData = { + external_id: '123', + country: 'US', + language: 'en', + email_subscribe: true, + push_subscribe: false, + subscription_groups: ['group1', 'group2'], + custom_attributes: { + color: 'blue', + age: 25, + }, + }; + store.set('123', storeData); + const result = BrazeDedupUtility.deduplicate(userData, store); + expect(store.size).toBe(1); + expect(result).toEqual({ + external_id: '123', + color: 'green', + age: 30, + gender: 'male', + language: 'en', + email_subscribe: true, + push_subscribe: false, + subscription_groups: ['group1', 'group2'], + }); + }); + test('returns null if all keys are in BRAZE_NON_BILLABLE_ATTRIBUTES', () => { const userData = { external_id: '123',