Skip to content

Commit

Permalink
fix: braze dedup add test case for non billable attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Dec 15, 2023
1 parent cfe5cf3 commit 4a99205
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/v0/destinations/braze/braze.util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 4a99205

Please sign in to comment.