-
Notifications
You must be signed in to change notification settings - Fork 0
XCH-2897 coppa support #4
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -200,6 +200,14 @@ describe('33acrossBidAdapter:', function () { | |
| return this; | ||
| }; | ||
|
|
||
| this.withCoppa = coppaValue => { | ||
| Object.assign(ttxRequest.regs, { | ||
| coppa: coppaValue | ||
| }); | ||
|
|
||
| return this; | ||
| }; | ||
|
|
||
| this.withSite = site => { | ||
| Object.assign(ttxRequest, { site }); | ||
| return this; | ||
|
|
@@ -1059,6 +1067,7 @@ describe('33acrossBidAdapter:', function () { | |
| .withBanner() | ||
| .withProduct() | ||
| .withGdprConsent('foobarMyPreference', 1) | ||
| .withCoppa(1) | ||
| .build(); | ||
| const serverRequest = new ServerRequestBuilder() | ||
| .withData(ttxRequest) | ||
|
|
@@ -1094,6 +1103,7 @@ describe('33acrossBidAdapter:', function () { | |
| const ttxRequest = new TtxRequestBuilder() | ||
| .withBanner() | ||
| .withProduct() | ||
| .withCoppa(1) | ||
| .build(); | ||
| const serverRequest = new ServerRequestBuilder() | ||
| .withData(ttxRequest) | ||
|
|
@@ -1138,6 +1148,7 @@ describe('33acrossBidAdapter:', function () { | |
| .withBanner() | ||
| .withProduct() | ||
| .withUspConsent('foo') | ||
| .withCoppa(1) | ||
| .build(); | ||
| const serverRequest = new ServerRequestBuilder() | ||
| .withData(ttxRequest) | ||
|
|
@@ -1173,6 +1184,7 @@ describe('33acrossBidAdapter:', function () { | |
| const ttxRequest = new TtxRequestBuilder() | ||
| .withBanner() | ||
| .withProduct() | ||
| .withCoppa(1) | ||
| .build(); | ||
| const serverRequest = new ServerRequestBuilder() | ||
| .withData(ttxRequest) | ||
|
|
@@ -1184,6 +1196,42 @@ describe('33acrossBidAdapter:', function () { | |
| }); | ||
| }); | ||
|
|
||
| context('when coppa is enabled', function() { | ||
| it('returns corresponding server requests with coppa: 1', function() { | ||
| sandbox.stub(config, 'getConfig').withArgs('coppa').returns(true); | ||
|
|
||
| const ttxRequest = new TtxRequestBuilder() | ||
| .withBanner() | ||
| .withProduct() | ||
| .withCoppa(1) | ||
| .build(); | ||
| const serverRequest = new ServerRequestBuilder() | ||
| .withData(ttxRequest) | ||
| .build(); | ||
| const [ builtServerRequest ] = spec.buildRequests(bidRequests, bidderRequest); | ||
|
|
||
| validateBuiltServerRequest(builtServerRequest, serverRequest); | ||
| }); | ||
| }); | ||
|
|
||
| context('when coppa is not enabled', function() { | ||
| it('returns corresponding server requests with coppa: 0', function() { | ||
| sandbox.stub(config, 'getConfig').withArgs('coppa').returns(false); | ||
|
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. most likely getConfig('coppa') will return undefined, that will be the common scenario, so I think you could adjust this spec to cover this case as well.. my recommendation is the following. e.g. Although this "undefined" case scenario might not be needed if we only add coppa to the request when the value is different than undefined, like I am suggesting in the other comment. |
||
|
|
||
| const ttxRequest = new TtxRequestBuilder() | ||
| .withBanner() | ||
| .withProduct() | ||
| .withCoppa(0) | ||
| .build(); | ||
| const serverRequest = new ServerRequestBuilder() | ||
| .withData(ttxRequest) | ||
| .build(); | ||
| const [ builtServerRequest ] = spec.buildRequests(bidRequests, bidderRequest); | ||
|
|
||
| validateBuiltServerRequest(builtServerRequest, serverRequest); | ||
| }); | ||
| }); | ||
|
|
||
| context('when refererInfo values are available', function() { | ||
| context('when refererInfo.page is defined', function() { | ||
| it('returns corresponding server requests with site.page set', function() { | ||
|
|
@@ -1780,12 +1828,14 @@ describe('33acrossBidAdapter:', function () { | |
| .withProduct('siab') | ||
| .withBanner() | ||
| .withVideo() | ||
| .withCoppa(1) | ||
| .build(); | ||
|
|
||
| const req2 = new TtxRequestBuilder('sample33xGUID123456780') | ||
| .withProduct('siab') | ||
| .withBanner() | ||
| .withVideo() | ||
| .withCoppa(1) | ||
| .build(); | ||
|
|
||
| req2.imp[0].id = 'b3'; | ||
|
|
@@ -1794,6 +1844,7 @@ describe('33acrossBidAdapter:', function () { | |
| .withProduct('inview') | ||
| .withBanner() | ||
| .withVideo() | ||
| .withCoppa(1) | ||
| .build(); | ||
|
|
||
| req3.imp[0].id = 'b4'; | ||
|
|
||
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.
what if you just add the coppa signal when it's present.
e.g.
wouldn't that help to reduce the
.withCoppa(0)calls in the specs and also be more in sync with other signals that we add to the request only when they are present such as the us_privacy and gpp. LMK what you think about this suggestion.