Skip to content

Commit

Permalink
Update syntax for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
SbDove committed Nov 6, 2024
1 parent 98f2486 commit b243923
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ Common.prototype.exampleMethod = function () {
}

Common.prototype.logId5Id = function (id5Id) {
var integrationAttributes = {};
integrationAttributes['encryptedId5Id'] = id5Id;
integrationAttributes['id5IdType'] = this.id5IdType;
if (id5Id == undefined) {
return;
}

var integrationAttributes = {
encryptedId5Id: id5Id,
id5IdType: this.id5IdType,
};

window.mParticle.setIntegrationAttributes(this.moduleId, integrationAttributes);
};

Expand Down
14 changes: 12 additions & 2 deletions test/src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ describe('ID5 Forwarder', function () {
// -------------------DO NOT EDIT ANYTHING ABOVE THIS LINE-----------------------
// -------------------START EDITING BELOW:-----------------------
// -------------------mParticle stubs - Add any additional stubbing to our methods as needed-----------------------
var Id5ModuleId = 248;
var userAttributes = {};
var integrationAttributes = {};

mParticle.Identity = {
getCurrentUser: function() {
return {
Expand Down Expand Up @@ -190,7 +192,7 @@ describe('ID5 Forwarder', function () {
},
};
var pd = mParticle.forwarder.common.buildPartnerData(user)
debugger;

expect(pd).to.be.null;
done();
});
Expand Down Expand Up @@ -322,10 +324,18 @@ describe('ID5 Forwarder', function () {

it ('should log an integration attribute when logId5Id is called', function(done) {
mParticle.forwarder.common.logId5Id("testId");
var attributes = integrationAttributes[248];
var attributes = integrationAttributes[Id5ModuleId];
attributes['encryptedId5Id'].should.equal('testId');
attributes['id5IdType'].should.equal('other_5')
done();
})

it ('should not log an integration attribute when logId5Id is called with a null or undefined value', function(done) {
mParticle.forwarder.common.logId5Id(null);
integrationAttributes[248].should.be.null;
mParticle.forwarder.common.logId5Id(undefined);
integrationAttributes[248].should.be.null;
done();
})
})
});

0 comments on commit b243923

Please sign in to comment.