From ce15b44d4c9201c749a007557e31d187a37001c1 Mon Sep 17 00:00:00 2001 From: Marsel Taipov Date: Thu, 18 Nov 2021 18:15:53 +0300 Subject: [PATCH 1/6] add uspConsent to sunc URL --- modules/kubientBidAdapter.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index 07c614230a7..465abbb0d99 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -110,24 +110,27 @@ export const spec = { }, getUserSyncs: function (syncOptions, serverResponses, gdprConsent, uspConsent) { const syncs = []; - let gdprParams = ''; + let params = ''; if (gdprConsent && typeof gdprConsent.consentString === 'string') { - gdprParams = `?consent_str=${gdprConsent.consentString}`; + params = `?consent_str=${gdprConsent.consentString}`; if (typeof gdprConsent.gdprApplies === 'boolean') { - gdprParams = gdprParams + `&gdpr=${Number(gdprConsent.gdprApplies)}`; + params = params + `&gdpr=${Number(gdprConsent.gdprApplies)}`; } - gdprParams = gdprParams + `&consent_given=` + kubientGetConsentGiven(gdprConsent); + params = params + `&consent_given=` + kubientGetConsentGiven(gdprConsent); + } + if (uspConsent) { + params += `${params ? '&' : '?'}us_privacy=${encodeURIComponent(uspConsent)}`; } if (syncOptions.iframeEnabled) { syncs.push({ type: 'iframe', - url: 'https://kdmp.kbntx.ch/init.html' + gdprParams + url: 'https://kdmp.kbntx.ch/init.html' + params }); } if (syncOptions.pixelEnabled) { syncs.push({ type: 'image', - url: 'https://kdmp.kbntx.ch/init.png' + gdprParams + url: 'https://kdmp.kbntx.ch/init.png' + params }); } return syncs; From 29f9866e85324e054438124fe0e9e1bf2fd16c20 Mon Sep 17 00:00:00 2001 From: Marsel Taipov Date: Mon, 6 Dec 2021 17:03:21 +0300 Subject: [PATCH 2/6] kubient: add coppa --- modules/kubientBidAdapter.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index 465abbb0d99..657a4563aa8 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -1,6 +1,7 @@ import { isArray, deepAccess } from '../src/utils.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; import {BANNER, VIDEO} from '../src/mediaTypes.js'; +import { config } from '../src/config.js'; const BIDDER_CODE = 'kubient'; const END_POINT = 'https://kssp.kbntx.ch/kubprebidjs'; @@ -59,7 +60,12 @@ export const spec = { gdpr: (bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) ? 1 : 0, consentGiven: kubientGetConsentGiven(bidderRequest.gdprConsent), uspConsent: bidderRequest.uspConsent - }; + } + + if (config.getConfig('coppa') === true) { + data.coppa = 1 + } + if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) { data.referer = bidderRequest.refererInfo.referer From d0ddee7159ac52ead9b864020ac16d4e0beca05d Mon Sep 17 00:00:00 2001 From: Marsel Taipov Date: Tue, 7 Dec 2021 13:16:36 +0300 Subject: [PATCH 3/6] added test for coppa --- modules/kubientBidAdapter.js | 1 - test/spec/modules/kubientBidAdapter_spec.js | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index 657a4563aa8..d8ab9f4f0e3 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -66,7 +66,6 @@ export const spec = { data.coppa = 1 } - if (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) { data.referer = bidderRequest.refererInfo.referer } diff --git a/test/spec/modules/kubientBidAdapter_spec.js b/test/spec/modules/kubientBidAdapter_spec.js index 5449de0c4de..90edc5d55d3 100644 --- a/test/spec/modules/kubientBidAdapter_spec.js +++ b/test/spec/modules/kubientBidAdapter_spec.js @@ -292,6 +292,22 @@ describe('KubientAdapter', function () { }); }); + describe('with COPPA', function() { + beforeEach(function() { + sinon.stub(config, 'getConfig') + .withArgs('coppa') + .returns(true); + }); + afterEach(function() { + config.getConfig.restore(); + }); + + it('should send the Coppa "required" flag set to "1" in the request', function () { + let serverRequest = spec.buildRequests([bidBanner]); + expect(serverRequest.data.coppa).to.equal(1); + }); + }); + describe('getUserSyncs', function () { it('should register the sync iframe without gdpr', function () { let syncOptions = { From 9693ce43da37fdd26a59eceff683b1a698a97a22 Mon Sep 17 00:00:00 2001 From: Artem Aleksashkin Date: Tue, 7 Dec 2021 18:01:53 +0300 Subject: [PATCH 4/6] fix-test --- test/spec/modules/kubientBidAdapter_spec.js | 44 +++++++++++++-------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/test/spec/modules/kubientBidAdapter_spec.js b/test/spec/modules/kubientBidAdapter_spec.js index 90edc5d55d3..f9e70c27980 100644 --- a/test/spec/modules/kubientBidAdapter_spec.js +++ b/test/spec/modules/kubientBidAdapter_spec.js @@ -292,22 +292,6 @@ describe('KubientAdapter', function () { }); }); - describe('with COPPA', function() { - beforeEach(function() { - sinon.stub(config, 'getConfig') - .withArgs('coppa') - .returns(true); - }); - afterEach(function() { - config.getConfig.restore(); - }); - - it('should send the Coppa "required" flag set to "1" in the request', function () { - let serverRequest = spec.buildRequests([bidBanner]); - expect(serverRequest.data.coppa).to.equal(1); - }); - }); - describe('getUserSyncs', function () { it('should register the sync iframe without gdpr', function () { let syncOptions = { @@ -411,5 +395,33 @@ describe('KubientAdapter', function () { expect(syncs[0].type).to.equal('image'); expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.png?consent_str=' + consentString + '&gdpr=1&consent_given=1'); }); + it('should register the sync image without gdpr and with uspConsent', function () { + let syncOptions = { + iframeEnabled: true + }; + let serverResponses = null; + let gdprConsent = { + consentString: consentString + }; + let uspConsent = '1YNN'; + let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); + expect(syncs).to.be.an('array').and.to.have.length(1); + expect(syncs[0].type).to.equal('iframe'); + expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.html?consent_str=' + consentString + '&consent_given=0&us_privacy=' + uspConsent); + }); + it('should register the sync image without gdpr and with uspConsent', function () { + let syncOptions = { + pixelEnabled: true + }; + let serverResponses = null; + let gdprConsent = { + consentString: consentString + }; + let uspConsent = '1YNN'; + let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); + expect(syncs).to.be.an('array').and.to.have.length(1); + expect(syncs[0].type).to.equal('image'); + expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.png?consent_str=' + consentString + '&consent_given=0&us_privacy=' + uspConsent); + }); }) }); From bea48019ebb3d09dae6441779269e0b774fecb14 Mon Sep 17 00:00:00 2001 From: Marsel Taipov Date: Thu, 9 Dec 2021 14:19:54 +0300 Subject: [PATCH 5/6] replace kdmp.kbntx.ch by matching.kubient.net remove iframe pixel support rename us_privacy -> usp rename consent_str -> consent use URLSearchParams for GET params --- modules/kubientBidAdapter.js | 21 +++--- test/spec/modules/kubientBidAdapter_spec.js | 72 ++------------------- 2 files changed, 13 insertions(+), 80 deletions(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index d8ab9f4f0e3..ba3cd91c950 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -1,8 +1,10 @@ import { isArray, deepAccess } from '../src/utils.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; +import URLSearchParams from 'core-js-pure/web/url-search-params' import {BANNER, VIDEO} from '../src/mediaTypes.js'; import { config } from '../src/config.js'; + const BIDDER_CODE = 'kubient'; const END_POINT = 'https://kssp.kbntx.ch/kubprebidjs'; const VERSION = '1.1'; @@ -115,27 +117,22 @@ export const spec = { }, getUserSyncs: function (syncOptions, serverResponses, gdprConsent, uspConsent) { const syncs = []; - let params = ''; + var values = new URLSearchParams(); + if (gdprConsent && typeof gdprConsent.consentString === 'string') { - params = `?consent_str=${gdprConsent.consentString}`; + values.append("consent", gdprConsent.consentString); if (typeof gdprConsent.gdprApplies === 'boolean') { - params = params + `&gdpr=${Number(gdprConsent.gdprApplies)}`; + values.append("gdpr", Number(gdprConsent.gdprApplies)); } - params = params + `&consent_given=` + kubientGetConsentGiven(gdprConsent); } if (uspConsent) { - params += `${params ? '&' : '?'}us_privacy=${encodeURIComponent(uspConsent)}`; - } - if (syncOptions.iframeEnabled) { - syncs.push({ - type: 'iframe', - url: 'https://kdmp.kbntx.ch/init.html' + params - }); + values.append("usp", uspConsent); } + if (syncOptions.pixelEnabled) { syncs.push({ type: 'image', - url: 'https://kdmp.kbntx.ch/init.png' + params + url: 'https://matching.kubient.net/match/sp?' + values.toString() }); } return syncs; diff --git a/test/spec/modules/kubientBidAdapter_spec.js b/test/spec/modules/kubientBidAdapter_spec.js index f9e70c27980..cb7c05e8e80 100644 --- a/test/spec/modules/kubientBidAdapter_spec.js +++ b/test/spec/modules/kubientBidAdapter_spec.js @@ -293,56 +293,6 @@ describe('KubientAdapter', function () { }); describe('getUserSyncs', function () { - it('should register the sync iframe without gdpr', function () { - let syncOptions = { - iframeEnabled: true - }; - let serverResponses = null; - let gdprConsent = { - consentString: consentString - }; - let uspConsent = null; - let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); - expect(syncs).to.be.an('array').and.to.have.length(1); - expect(syncs[0].type).to.equal('iframe'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.html?consent_str=' + consentString + '&consent_given=0'); - }); - it('should register the sync iframe with gdpr', function () { - let syncOptions = { - iframeEnabled: true - }; - let serverResponses = null; - let gdprConsent = { - gdprApplies: true, - consentString: consentString - }; - let uspConsent = null; - let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); - expect(syncs).to.be.an('array').and.to.have.length(1); - expect(syncs[0].type).to.equal('iframe'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.html?consent_str=' + consentString + '&gdpr=1&consent_given=0'); - }); - it('should register the sync iframe with gdpr vendor', function () { - let syncOptions = { - iframeEnabled: true - }; - let serverResponses = null; - let gdprConsent = { - gdprApplies: true, - consentString: consentString, - apiVersion: 1, - vendorData: { - vendorConsents: { - 794: 1 - } - } - }; - let uspConsent = null; - let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); - expect(syncs).to.be.an('array').and.to.have.length(1); - expect(syncs[0].type).to.equal('iframe'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.html?consent_str=' + consentString + '&gdpr=1&consent_given=1'); - }); it('should register the sync image without gdpr', function () { let syncOptions = { pixelEnabled: true @@ -355,7 +305,7 @@ describe('KubientAdapter', function () { let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.png?consent_str=' + consentString + '&consent_given=0'); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString); }); it('should register the sync image with gdpr', function () { let syncOptions = { @@ -370,7 +320,7 @@ describe('KubientAdapter', function () { let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.png?consent_str=' + consentString + '&gdpr=1&consent_given=0'); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString + '&gdpr=1'); }); it('should register the sync image with gdpr vendor', function () { let syncOptions = { @@ -393,21 +343,7 @@ describe('KubientAdapter', function () { let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.png?consent_str=' + consentString + '&gdpr=1&consent_given=1'); - }); - it('should register the sync image without gdpr and with uspConsent', function () { - let syncOptions = { - iframeEnabled: true - }; - let serverResponses = null; - let gdprConsent = { - consentString: consentString - }; - let uspConsent = '1YNN'; - let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); - expect(syncs).to.be.an('array').and.to.have.length(1); - expect(syncs[0].type).to.equal('iframe'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.html?consent_str=' + consentString + '&consent_given=0&us_privacy=' + uspConsent); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString + '&gdpr=1'); }); it('should register the sync image without gdpr and with uspConsent', function () { let syncOptions = { @@ -421,7 +357,7 @@ describe('KubientAdapter', function () { let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://kdmp.kbntx.ch/init.png?consent_str=' + consentString + '&consent_given=0&us_privacy=' + uspConsent); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString + '&usp=' + uspConsent); }); }) }); From 3511dcc58302802d1ded26e5192f4c90a03af0df Mon Sep 17 00:00:00 2001 From: Artem Aleksashkin Date: Fri, 10 Dec 2021 01:38:49 +0300 Subject: [PATCH 6/6] fix-test-and-code --- modules/kubientBidAdapter.js | 11 +- test/spec/modules/kubientBidAdapter_spec.js | 109 +++++++++++++++++++- 2 files changed, 110 insertions(+), 10 deletions(-) diff --git a/modules/kubientBidAdapter.js b/modules/kubientBidAdapter.js index ba3cd91c950..d9b4220acbc 100644 --- a/modules/kubientBidAdapter.js +++ b/modules/kubientBidAdapter.js @@ -1,10 +1,9 @@ import { isArray, deepAccess } from '../src/utils.js'; import {registerBidder} from '../src/adapters/bidderFactory.js'; -import URLSearchParams from 'core-js-pure/web/url-search-params' +import URLSearchParams from 'core-js-pure/web/url-search-params'; import {BANNER, VIDEO} from '../src/mediaTypes.js'; import { config } from '../src/config.js'; - const BIDDER_CODE = 'kubient'; const END_POINT = 'https://kssp.kbntx.ch/kubprebidjs'; const VERSION = '1.1'; @@ -117,16 +116,16 @@ export const spec = { }, getUserSyncs: function (syncOptions, serverResponses, gdprConsent, uspConsent) { const syncs = []; - var values = new URLSearchParams(); + let values = new URLSearchParams(); if (gdprConsent && typeof gdprConsent.consentString === 'string') { - values.append("consent", gdprConsent.consentString); + values.append('consent', gdprConsent.consentString); if (typeof gdprConsent.gdprApplies === 'boolean') { - values.append("gdpr", Number(gdprConsent.gdprApplies)); + values.append('gdpr', Number(gdprConsent.gdprApplies)); } } if (uspConsent) { - values.append("usp", uspConsent); + values.append('usp', uspConsent); } if (syncOptions.pixelEnabled) { diff --git a/test/spec/modules/kubientBidAdapter_spec.js b/test/spec/modules/kubientBidAdapter_spec.js index cb7c05e8e80..04392ab8d21 100644 --- a/test/spec/modules/kubientBidAdapter_spec.js +++ b/test/spec/modules/kubientBidAdapter_spec.js @@ -1,6 +1,8 @@ import { expect, assert } from 'chai'; import { spec } from 'modules/kubientBidAdapter.js'; import { BANNER, VIDEO } from '../../../src/mediaTypes.js'; +import URLSearchParams from 'core-js-pure/web/url-search-params'; +import {config} from '../../../src/config'; describe('KubientAdapter', function () { let bidBanner = { @@ -175,6 +177,94 @@ describe('KubientAdapter', function () { }); } }); + describe('buildRequestBanner', function () { + config.setConfig({coppa: true}); + let serverRequests = spec.buildRequests([bidBanner], Object.assign({}, bidderRequest, {bids: [bidBanner]})); + config.resetConfig(); + it('Creates a ServerRequest object with method, URL and data', function () { + expect(serverRequests).to.be.an('array'); + }); + for (let i = 0; i < serverRequests.length; i++) { + let serverRequest = serverRequests[i]; + it('Creates a ServerRequest object with method, URL and data', function () { + expect(serverRequest.method).to.be.a('string'); + expect(serverRequest.url).to.be.a('string'); + expect(serverRequest.data).to.be.a('string'); + }); + it('Returns POST method', function () { + expect(serverRequest.method).to.equal('POST'); + }); + it('Returns valid URL', function () { + expect(serverRequest.url).to.equal('https://kssp.kbntx.ch/kubprebidjs'); + }); + it('Returns valid data if array of bids is valid', function () { + let data = JSON.parse(serverRequest.data); + expect(data).to.be.an('object'); + expect(data).to.have.all.keys('v', 'requestId', 'adSlots', 'gdpr', 'coppa', 'referer', 'tmax', 'consent', 'consentGiven', 'uspConsent'); + expect(data.v).to.exist.and.to.be.a('string'); + expect(data.requestId).to.exist.and.to.be.a('string'); + expect(data.coppa).to.be.a('number').and.to.equal(1); + expect(data.referer).to.be.a('string'); + expect(data.tmax).to.exist.and.to.be.a('number'); + expect(data.gdpr).to.exist.and.to.be.within(0, 1); + expect(data.consent).to.equal(consentString); + expect(data.uspConsent).to.exist.and.to.equal(uspConsentData); + for (let j = 0; j < data['adSlots'].length; j++) { + let adSlot = data['adSlots'][i]; + expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'floor', 'banner', 'schain'); + expect(adSlot.bidId).to.be.a('string').and.to.equal(bidBanner.bidId); + expect(adSlot.zoneId).to.be.a('string').and.to.equal(bidBanner.params.zoneid); + expect(adSlot.floor).to.be.a('number'); + expect(adSlot.schain).to.be.an('object'); + expect(adSlot.banner).to.be.an('object'); + } + }); + } + }); + describe('buildRequestVideo', function () { + config.setConfig({coppa: true}); + let serverRequests = spec.buildRequests([bidVideo], Object.assign({}, bidderRequest, {bids: [bidVideo]})); + config.resetConfig(); + it('Creates a ServerRequest object with method, URL and data', function () { + expect(serverRequests).to.be.an('array'); + }); + for (let i = 0; i < serverRequests.length; i++) { + let serverRequest = serverRequests[i]; + it('Creates a ServerRequest object with method, URL and data', function () { + expect(serverRequest.method).to.be.a('string'); + expect(serverRequest.url).to.be.a('string'); + expect(serverRequest.data).to.be.a('string'); + }); + it('Returns POST method', function () { + expect(serverRequest.method).to.equal('POST'); + }); + it('Returns valid URL', function () { + expect(serverRequest.url).to.equal('https://kssp.kbntx.ch/kubprebidjs'); + }); + it('Returns valid data if array of bids is valid', function () { + let data = JSON.parse(serverRequest.data); + expect(data).to.be.an('object'); + expect(data).to.have.all.keys('v', 'requestId', 'adSlots', 'gdpr', 'coppa', 'referer', 'tmax', 'consent', 'consentGiven', 'uspConsent'); + expect(data.v).to.exist.and.to.be.a('string'); + expect(data.requestId).to.exist.and.to.be.a('string'); + expect(data.coppa).to.be.a('number').and.to.equal(1); + expect(data.referer).to.be.a('string'); + expect(data.tmax).to.exist.and.to.be.a('number'); + expect(data.gdpr).to.exist.and.to.be.within(0, 1); + expect(data.consent).to.equal(consentString); + expect(data.uspConsent).to.exist.and.to.equal(uspConsentData); + for (let j = 0; j < data['adSlots'].length; j++) { + let adSlot = data['adSlots'][i]; + expect(adSlot).to.have.all.keys('bidId', 'zoneId', 'floor', 'video', 'schain'); + expect(adSlot.bidId).to.be.a('string').and.to.equal(bidVideo.bidId); + expect(adSlot.zoneId).to.be.a('string').and.to.equal(bidVideo.params.zoneid); + expect(adSlot.floor).to.be.a('number'); + expect(adSlot.schain).to.be.an('object'); + expect(adSlot.video).to.be.an('object'); + } + }); + } + }); describe('isBidRequestValid', function () { it('Should return true when required params are found', function () { @@ -297,20 +387,23 @@ describe('KubientAdapter', function () { let syncOptions = { pixelEnabled: true }; + let values = new URLSearchParams(); let serverResponses = null; let gdprConsent = { consentString: consentString }; let uspConsent = null; let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); + values.append('consent', consentString); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?' + values.toString()); }); it('should register the sync image with gdpr', function () { let syncOptions = { pixelEnabled: true }; + let values = new URLSearchParams(); let serverResponses = null; let gdprConsent = { gdprApplies: true, @@ -318,14 +411,17 @@ describe('KubientAdapter', function () { }; let uspConsent = null; let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); + values.append('consent', consentString); + values.append('gdpr', 1); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString + '&gdpr=1'); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?' + values.toString()); }); it('should register the sync image with gdpr vendor', function () { let syncOptions = { pixelEnabled: true }; + let values = new URLSearchParams(); let serverResponses = null; let gdprConsent = { gdprApplies: true, @@ -341,23 +437,28 @@ describe('KubientAdapter', function () { }; let uspConsent = null; let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); + values.append('consent', consentString); + values.append('gdpr', 1); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString + '&gdpr=1'); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?' + values.toString()); }); it('should register the sync image without gdpr and with uspConsent', function () { let syncOptions = { pixelEnabled: true }; + let values = new URLSearchParams(); let serverResponses = null; let gdprConsent = { consentString: consentString }; let uspConsent = '1YNN'; let syncs = spec.getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent); + values.append('consent', consentString); + values.append('usp', uspConsent); expect(syncs).to.be.an('array').and.to.have.length(1); expect(syncs[0].type).to.equal('image'); - expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?consent=' + consentString + '&usp=' + uspConsent); + expect(syncs[0].url).to.equal('https://matching.kubient.net/match/sp?' + values.toString()); }); }) });