-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:send default and update consent payloads on kit init #58
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1227,7 +1227,7 @@ describe('Adwords forwarder', function () { | |
done(); | ||
}); | ||
|
||
it('should merge Consent Setting Defaults with User Consent State to construct a Default Consent State', function (done) { | ||
it('should construct a Default Consent State Payload from Default Settings and construct an Update Consent State Payload from Mappings', function (done) { | ||
mParticle.forwarder.init( | ||
{ | ||
conversionId: 'AW-123123123', | ||
|
@@ -1242,9 +1242,20 @@ describe('Adwords forwarder', function () { | |
true | ||
); | ||
|
||
var expectedDataLayer = [ | ||
var expectedDataLayer1 = [ | ||
'consent', | ||
'default', | ||
{ | ||
ad_personalization: 'granted', // From Consent Settings | ||
ad_user_data: 'granted', // From Consent Settings | ||
ad_storage: 'granted', // From Consent Settings | ||
analytics_storage: 'granted', // From Consent Settings | ||
}, | ||
]; | ||
|
||
var expectedDataLayer2 = [ | ||
'consent', | ||
'update', | ||
{ | ||
ad_personalization: 'denied', // From User Consent State | ||
ad_user_data: 'denied', // From User Consent State | ||
|
@@ -1253,10 +1264,13 @@ describe('Adwords forwarder', function () { | |
}, | ||
]; | ||
|
||
window.dataLayer.length.should.eql(1); | ||
window.dataLayer.length.should.eql(2); | ||
window.dataLayer[0][0].should.equal('consent'); | ||
window.dataLayer[0][1].should.equal('default'); | ||
window.dataLayer[0][2].should.deepEqual(expectedDataLayer[2]); | ||
window.dataLayer[0][2].should.deepEqual(expectedDataLayer1[2]); | ||
window.dataLayer[1][0].should.equal('consent'); | ||
window.dataLayer[1][1].should.equal('update'); | ||
window.dataLayer[1][2].should.deepEqual(expectedDataLayer2[2]); | ||
|
||
done(); | ||
}); | ||
|
@@ -1465,7 +1479,18 @@ describe('Adwords forwarder', function () { | |
true | ||
); | ||
|
||
var expectedDataLayerBefore = [ | ||
var expectedDataLayerBefore1 = [ | ||
'consent', | ||
'default', | ||
{ | ||
ad_personalization: 'granted', // From Consent Settings | ||
ad_user_data: 'granted', // From Consent Settings | ||
ad_storage: 'granted', // From Consent Settings | ||
analytics_storage: 'granted', // From Consent Settings | ||
}, | ||
]; | ||
|
||
var expectedDataLayerBefore2 = [ | ||
'consent', | ||
'update', | ||
{ | ||
|
@@ -1476,11 +1501,16 @@ describe('Adwords forwarder', function () { | |
}, | ||
]; | ||
|
||
window.dataLayer.length.should.eql(1); | ||
window.dataLayer.length.should.eql(2); | ||
window.dataLayer[0][0].should.equal('consent'); | ||
window.dataLayer[0][1].should.equal('default'); | ||
window.dataLayer[0][2].should.deepEqual( | ||
expectedDataLayerBefore[2] | ||
expectedDataLayerBefore1[2] | ||
); | ||
window.dataLayer[1][0].should.equal('consent'); | ||
window.dataLayer[1][1].should.equal('update'); | ||
window.dataLayer[1][2].should.deepEqual( | ||
expectedDataLayerBefore2[2] | ||
Comment on lines
+1504
to
+1513
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment about doing deepEqual to the full object |
||
); | ||
|
||
mParticle.forwarder.process({ | ||
|
@@ -1536,10 +1566,10 @@ describe('Adwords forwarder', function () { | |
}, | ||
]; | ||
|
||
window.dataLayer.length.should.eql(2); | ||
window.dataLayer[1][0].should.equal('consent'); | ||
window.dataLayer[1][1].should.equal('update'); | ||
window.dataLayer[1][2].should.deepEqual( | ||
window.dataLayer.length.should.eql(3); | ||
window.dataLayer[2][0].should.equal('consent'); | ||
window.dataLayer[2][1].should.equal('update'); | ||
window.dataLayer[2][2].should.deepEqual( | ||
expectedDataLayerAfter[2] | ||
Comment on lines
+1570
to
1573
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto to above |
||
); | ||
|
||
|
@@ -1606,10 +1636,10 @@ describe('Adwords forwarder', function () { | |
}, | ||
]; | ||
|
||
window.dataLayer.length.should.eql(3); | ||
window.dataLayer[2][0].should.equal('consent'); | ||
window.dataLayer[2][1].should.equal('update'); | ||
window.dataLayer[2][2].should.deepEqual( | ||
window.dataLayer.length.should.eql(4); | ||
window.dataLayer[3][0].should.equal('consent'); | ||
window.dataLayer[3][1].should.equal('update'); | ||
window.dataLayer[3][2].should.deepEqual( | ||
expectedDataLayerFinal[2] | ||
Comment on lines
+1639
to
1643
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tritto to above |
||
); | ||
done(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had similar feedback for alex here - you can probably refactor these 2 checks for the [0] and [1] index to be something like:
window.dataLayer[0].should.deepEqual(expectedDataLayer1)
window.dataLayer[1].should.deepEqual(expectedDataLayer2)