Skip to content

Commit

Permalink
Add case for when brazeUserIDType is null/undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
rmi22186 committed May 2, 2024
1 parent edc7067 commit dd4c425
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/BrazeKit-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,11 @@ var constructor = function () {
];
}

kitLogger('braze.changeUser', brazeUserIDType);
if (brazeUserIDType) {
kitLogger('braze.changeUser', brazeUserIDType);

braze.changeUser(brazeUserIDType);
braze.changeUser(brazeUserIDType);
}

if (userIdentities.email) {
kitLogger('braze.getUser().setEmail', userIdentities.email);
Expand Down
9 changes: 9 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,15 @@ describe('Braze Forwarder', function() {
window.braze.getUser().emailSet.should.equal('[email protected]');
});

it('should not attempt to set an identity on braze if the userIdentificationType does not exist on the customer', function() {
mParticle.forwarder.init({
apiKey: '123456',
userIdentificationType: 'other2',
});

Should(window.braze.userId).equal(null);
});

it('should set main braze user identity from userIdentificationType ', function() {
mParticle.forwarder.init({
apiKey: '123456',
Expand Down

0 comments on commit dd4c425

Please sign in to comment.