Skip to content

Commit

Permalink
Address PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexs-mparticle committed Sep 26, 2024
1 parent 83c03c9 commit dd46f94
Showing 1 changed file with 9 additions and 63 deletions.
72 changes: 9 additions & 63 deletions test/src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ describe('Bing Ads Event Forwarder', function() {

// UETQ queues up events as array elements and then parses them internally.
// The first 3 elements of this array will be the consent payload
// The 4th element will be the event payload
window.uetq.length.should.eql(3);
window.uetq[0].should.equal('consent');
window.uetq[1].should.equal('default');
Expand Down Expand Up @@ -193,7 +192,7 @@ describe('Bing Ads Event Forwarder', function() {
window.uetq = [];
});

it('should consolidate consent information', function(done) {
it('should consent information to window.uetq', function(done) {
mParticle.forwarder.init(
{
tagId: 'tagId',
Expand Down Expand Up @@ -250,7 +249,7 @@ describe('Bing Ads Event Forwarder', function() {
done();
});

it('should construct a Default Consent State Payload from Mappings on init', function(done) {
it('should construct a Default Consent State Payload of `granted` from Mappings when `defaultAdStorageConsentWeb` is undefined', function(done) {
mParticle.forwarder.init(
{
tagId: 'tagId',
Expand All @@ -270,11 +269,7 @@ describe('Bing Ads Event Forwarder', function() {
// UETQ queues up events as array elements and then parses them internally.
// The first 3 elements of this array will be the consent payload
window.uetq.length.should.eql(3);
window.uetq.should.eql([
'consent',
'default',
expectedConsentPayload[2],
]);
window.uetq.should.eql(expectedConsentPayload);

done();
});
Expand Down Expand Up @@ -303,9 +298,7 @@ describe('Bing Ads Event Forwarder', function() {
];

window.uetq.length.should.eql(3);
window.uetq[0].should.equal('consent');
window.uetq[1].should.equal('default');
window.uetq[2].should.eql(expectedInitialConsentPayload[2]);
window.uetq.should.eql(expectedInitialConsentPayload);

var obj = {
EventDataType: MessageType.PageEvent,
Expand Down Expand Up @@ -371,13 +364,11 @@ describe('Bing Ads Event Forwarder', function() {
];

window.uetq.length.should.eql(3);
window.uetq[0].should.equal('consent');
window.uetq[1].should.equal('default');
window.uetq[2].should.eql(expectedConsentPayload[2]);
window.uetq.should.eql(expectedConsentPayload);
done();
});

it('should construct a Consent State Update Payload when consent changes', function(done) {
it('should construct a Consent State Update Payload when consent changes and defaultAdStorageConsentWeb is undefined', function(done) {
mParticle.forwarder.init(
{
tagId: 'tagId',
Expand Down Expand Up @@ -453,7 +444,7 @@ describe('Bing Ads Event Forwarder', function() {
done();
});

it('should construct a Consent State Update Payload with Consent Setting Defaults when consent changes', function(done) {
it('should construct a Consent State Update Payload when consent changes', function(done) {
mParticle.forwarder.init(
{
tagId: 'tagId',
Expand Down Expand Up @@ -587,7 +578,7 @@ describe('Bing Ads Event Forwarder', function() {

mParticle.forwarder.process(obj);

// UETQ should now have 7 elements
// UETQ should now have 4 elements
// The first 3 elements of this array will be the initial consent payload
// The 4th element will be the event payload

Expand Down Expand Up @@ -625,51 +616,6 @@ describe('Bing Ads Event Forwarder', function() {
window.uetq[1].should.equal('default');
window.uetq[2].should.eql(expectedInitialConsentPayload[2]);

var obj = {
EventDataType: MessageType.PageEvent,
EventName: 'Test Page Event',
CustomFlags: {
'Bing.EventValue': 10,
},
ConsentState: {
getGDPRConsentState: function() {
return {
marketing_consent: {
Consented: true,
Timestamp: 1557935884509,
ConsentDocument: 'Marketing_Consent',
Location: 'This is fake',
HardwareId: '123456',
},
};
},

getCCPAConsentState: function() {
return {
data_sale_opt_out: {
Consented: false,
Timestamp: Date.now(),
Document: 'some_consent',
},
};
},
},
};

mParticle.forwarder.process(obj);

// UETQ should now have 7 elements
// The first 3 elements of this array will be the initial consent payload
// The 4th element will be the event payload

window.uetq.length.should.eql(4);
window.uetq[3].should.eql({
ea: 'pageLoad',
ec: 'This is my name!',
el: 'Test Page Event',
ev: 10,
});

done();
});

Expand Down Expand Up @@ -730,7 +676,7 @@ describe('Bing Ads Event Forwarder', function() {

mParticle.forwarder.process(obj);

// UETQ should now have 7 elements
// UETQ should now have 4 elements
// The first 3 elements of this array will be the initial consent payload
// The 4th element will be the event payload

Expand Down

0 comments on commit dd46f94

Please sign in to comment.