-
Notifications
You must be signed in to change notification settings - Fork 0
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
ARGO-715 added change to fall back to the TCF cookies when no data is… #7
base: master
Are you sure you want to change the base?
Changes from 3 commits
4f1285f
551de47
386fc06
3c7e394
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 |
---|---|---|
|
@@ -440,10 +440,153 @@ describe('LotameId', function() { | |
}); | ||
}); | ||
|
||
it('should retrieve the id when decode is called', function() { | ||
var id = lotamePanoramaIdSubmodule.decode('1234'); | ||
expect(id).to.be.eql({ | ||
'lotamePanoramaId': '1234' | ||
describe('when gdpr applies and falls back to eupubconsent cookie', function () { | ||
let request; | ||
let callBackSpy = sinon.spy(); | ||
let consentData = { | ||
gdprApplies: true, | ||
consentString: undefined | ||
}; | ||
|
||
beforeEach(function () { | ||
getCookieStub | ||
.withArgs('eupubconsent-v2') | ||
.returns('consentGiven'); | ||
|
||
let submoduleCallback = lotamePanoramaIdSubmodule.getId({}, consentData).callback; | ||
submoduleCallback(callBackSpy); | ||
|
||
// the contents of the response don't matter for this | ||
request = server.requests[0]; | ||
request.respond(200, responseHeader, ''); | ||
}); | ||
|
||
it('should call the remote server when getId is called', function () { | ||
expect(callBackSpy.calledOnce).to.be.true; | ||
}); | ||
|
||
it('should pass the gdpr consent string back', function() { | ||
expect(request.url).to.be.eq( | ||
'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven' | ||
); | ||
}); | ||
}); | ||
|
||
describe('when gdpr applies and falls back to euconsent cookie', function () { | ||
let request; | ||
let callBackSpy = sinon.spy(); | ||
let consentData = { | ||
gdprApplies: true, | ||
consentString: undefined | ||
}; | ||
|
||
beforeEach(function () { | ||
getCookieStub | ||
.withArgs('euconsent-v2') | ||
.returns('consentGiven'); | ||
|
||
let submoduleCallback = lotamePanoramaIdSubmodule.getId({}, consentData).callback; | ||
submoduleCallback(callBackSpy); | ||
|
||
// the contents of the response don't matter for this | ||
request = server.requests[0]; | ||
request.respond(200, responseHeader, ''); | ||
}); | ||
|
||
it('should call the remote server when getId is called', function () { | ||
expect(callBackSpy.calledOnce).to.be.true; | ||
}); | ||
|
||
it('should pass the gdpr consent string back', function() { | ||
expect(request.url).to.be.eq( | ||
'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven' | ||
); | ||
}); | ||
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. please add one more where there are no cookies to fall back to confirming that we don't add the query params 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. Done! |
||
}); | ||
|
||
describe('when gdpr applies but no consent string is available', function () { | ||
let request; | ||
let callBackSpy = sinon.spy(); | ||
let consentData = { | ||
gdprApplies: true, | ||
consentString: undefined | ||
}; | ||
|
||
beforeEach(function () { | ||
let submoduleCallback = lotamePanoramaIdSubmodule.getId({}, consentData).callback; | ||
submoduleCallback(callBackSpy); | ||
|
||
// the contents of the response don't matter for this | ||
request = server.requests[0]; | ||
request.respond(200, responseHeader, ''); | ||
}); | ||
|
||
it('should call the remote server when getId is called', function () { | ||
expect(callBackSpy.calledOnce).to.be.true; | ||
}); | ||
|
||
it('should not include the gdpr consent string on the url', function() { | ||
expect(request.url).to.be.eq( | ||
'https://id.crwdcntrl.net/id?gdpr_applies=true' | ||
); | ||
}); | ||
}); | ||
|
||
describe('when no consentData and falls back to eupubconsent cookie', function () { | ||
let request; | ||
let callBackSpy = sinon.spy(); | ||
let consentData; | ||
|
||
beforeEach(function () { | ||
getCookieStub | ||
.withArgs('eupubconsent-v2') | ||
.returns('consentGiven'); | ||
|
||
let submoduleCallback = lotamePanoramaIdSubmodule.getId({}, consentData).callback; | ||
submoduleCallback(callBackSpy); | ||
|
||
// the contents of the response don't matter for this | ||
request = server.requests[0]; | ||
request.respond(200, responseHeader, ''); | ||
}); | ||
|
||
it('should call the remote server when getId is called', function () { | ||
expect(callBackSpy.calledOnce).to.be.true; | ||
}); | ||
|
||
it('should pass the gdpr consent string back', function() { | ||
expect(request.url).to.be.eq( | ||
'https://id.crwdcntrl.net/id?gdpr_consent=consentGiven' | ||
); | ||
}); | ||
}); | ||
|
||
describe('when no consentData and falls back to euconsent cookie', function () { | ||
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. maybe one more - when no consent data and no fallback cookies? 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. Sure thing! |
||
let request; | ||
let callBackSpy = sinon.spy(); | ||
let consentData; | ||
|
||
beforeEach(function () { | ||
getCookieStub | ||
.withArgs('euconsent-v2') | ||
.returns('consentGiven'); | ||
|
||
let submoduleCallback = lotamePanoramaIdSubmodule.getId({}, consentData).callback; | ||
submoduleCallback(callBackSpy); | ||
|
||
// the contents of the response don't matter for this | ||
request = server.requests[0]; | ||
request.respond(200, responseHeader, ''); | ||
}); | ||
|
||
it('should call the remote server when getId is called', function () { | ||
expect(callBackSpy.calledOnce).to.be.true; | ||
}); | ||
|
||
it('should pass the gdpr consent string back', function() { | ||
expect(request.url).to.be.eq( | ||
'https://id.crwdcntrl.net/id?gdpr_consent=consentGiven' | ||
); | ||
}); | ||
}); | ||
}); |
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.
The fallback to the cookies should have tests where consentdata and gdpr applies aren't populated as those are both populated by the cmp. The way the code is currently written will have no practical effect.