prebid.js 7.29.0 → 7.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidViewability.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/byDataAnalyticsAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/ccxBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/colossussspBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagement.js +1 -1
- package/dist/consentManagementGpp.js +1 -0
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/dfpAdServerVideo.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +122 -120
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rtdModule.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/viouslyBidAdapter.js +1 -0
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/integrationExamples/gpt/gpp_us_hello_world.html +124 -0
- package/integrationExamples/gpt/gpp_us_hello_world_iframe.html +12 -0
- package/integrationExamples/gpt/gpp_us_hello_world_iframe_subpage.html +140 -0
- package/karma.conf.maker.js +1 -1
- package/modules/appnexusBidAdapter.js +23 -2
- package/modules/bidViewability.js +6 -1
- package/modules/ccxBidAdapter.js +3 -2
- package/modules/colossussspBidAdapter.js +8 -0
- package/modules/consentManagement.js +4 -4
- package/modules/consentManagementGpp.js +386 -0
- package/modules/dfpAdServerVideo.js +6 -1
- package/modules/gridBidAdapter.js +1 -2
- package/modules/lassoBidAdapter.js +2 -2
- package/modules/magniteAnalyticsAdapter.js +9 -1
- package/modules/onetagBidAdapter.js +20 -29
- package/modules/prebidServerBidAdapter/index.js +19 -8
- package/modules/rtdModule/index.js +2 -1
- package/modules/viouslyBidAdapter.js +209 -0
- package/modules/viouslyBidAdapter.md +35 -0
- package/package.json +1 -1
- package/src/adapterManager.js +11 -10
- package/src/adapters/bidderFactory.js +5 -5
- package/src/consentHandler.js +11 -0
- package/src/prebid.js +2 -1
- package/test/helpers/hookSetup.js +5 -0
- package/test/spec/modules/ViouslyBidAdapter_spec.js +378 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +46 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +89 -2
- package/test/spec/modules/consentManagementGpp_spec.js +577 -0
- package/test/spec/modules/gridBidAdapter_spec.js +0 -18
- package/test/spec/modules/magniteAnalyticsAdapter_spec.js +36 -14
- package/test/spec/modules/onetagBidAdapter_spec.js +29 -23
- package/test/spec/modules/topicsFpdModule_spec.js +41 -22
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spec, isValid, hasTypeVideo, isSchainValid } from 'modules/onetagBidAdapter.js';
|
|
2
2
|
import { expect } from 'chai';
|
|
3
|
-
import {find} from 'src/polyfill.js';
|
|
3
|
+
import { find } from 'src/polyfill.js';
|
|
4
4
|
import { BANNER, VIDEO } from 'src/mediaTypes.js';
|
|
5
|
-
import {INSTREAM, OUTSTREAM} from 'src/video.js';
|
|
5
|
+
import { INSTREAM, OUTSTREAM } from 'src/video.js';
|
|
6
6
|
|
|
7
7
|
describe('onetag', function () {
|
|
8
8
|
function createBid() {
|
|
@@ -122,14 +122,14 @@ describe('onetag', function () {
|
|
|
122
122
|
it('Should return true when correct multi format bid is passed', function () {
|
|
123
123
|
expect(spec.isBidRequestValid(createMultiFormatBid())).to.be.true;
|
|
124
124
|
});
|
|
125
|
-
it('Should split multi format bid into two single format bid with same bidId', function() {
|
|
126
|
-
const bids = JSON.parse(spec.buildRequests([
|
|
125
|
+
it('Should split multi format bid into two single format bid with same bidId', function () {
|
|
126
|
+
const bids = JSON.parse(spec.buildRequests([createMultiFormatBid()]).data).bids;
|
|
127
127
|
expect(bids.length).to.equal(2);
|
|
128
128
|
expect(bids[0].bidId).to.equal(bids[1].bidId);
|
|
129
129
|
});
|
|
130
|
-
it('Should retrieve correct request bid when extracting video request data', function() {
|
|
130
|
+
it('Should retrieve correct request bid when extracting video request data', function () {
|
|
131
131
|
const requestBid = createMultiFormatBid();
|
|
132
|
-
const multiFormatRequest = spec.buildRequests([
|
|
132
|
+
const multiFormatRequest = spec.buildRequests([requestBid]);
|
|
133
133
|
const serverResponse = {
|
|
134
134
|
body: {
|
|
135
135
|
bids: [
|
|
@@ -173,24 +173,30 @@ describe('onetag', function () {
|
|
|
173
173
|
const data = JSON.parse(d);
|
|
174
174
|
it('Should contain all keys', function () {
|
|
175
175
|
expect(data).to.be.an('object');
|
|
176
|
-
expect(data).to.include.all.keys('location', 'referrer', '
|
|
177
|
-
expect(data.location).to.
|
|
178
|
-
|
|
176
|
+
expect(data).to.include.all.keys('location', 'referrer', 'stack', 'numIframes', 'sHeight', 'sWidth', 'docHeight', 'wHeight', 'wWidth', 'oHeight', 'oWidth', 'aWidth', 'aHeight', 'sLeft', 'sTop', 'hLength', 'bids', 'docHidden', 'xOffset', 'yOffset', 'networkConnectionType', 'networkEffectiveConnectionType', 'timing', 'version');
|
|
177
|
+
expect(data.location).to.satisfy(function (value) {
|
|
178
|
+
return value === null || typeof value === 'string';
|
|
179
|
+
});
|
|
179
180
|
expect(data.referrer).to.satisfy(referrer => referrer === null || typeof referrer === 'string');
|
|
181
|
+
expect(data.stack).to.be.an('array');
|
|
182
|
+
expect(data.numIframes).to.be.a('number');
|
|
180
183
|
expect(data.sHeight).to.be.a('number');
|
|
181
184
|
expect(data.sWidth).to.be.a('number');
|
|
182
185
|
expect(data.wWidth).to.be.a('number');
|
|
183
186
|
expect(data.wHeight).to.be.a('number');
|
|
184
187
|
expect(data.oHeight).to.be.a('number');
|
|
185
188
|
expect(data.oWidth).to.be.a('number');
|
|
186
|
-
expect(data.ancestorOrigin).to.satisfy(function (value) {
|
|
187
|
-
return value === null || typeof value === 'string';
|
|
188
|
-
});
|
|
189
189
|
expect(data.aWidth).to.be.a('number');
|
|
190
190
|
expect(data.aHeight).to.be.a('number');
|
|
191
191
|
expect(data.sLeft).to.be.a('number');
|
|
192
192
|
expect(data.sTop).to.be.a('number');
|
|
193
193
|
expect(data.hLength).to.be.a('number');
|
|
194
|
+
expect(data.networkConnectionType).to.satisfy(function (value) {
|
|
195
|
+
return value === null || typeof value === 'string'
|
|
196
|
+
});
|
|
197
|
+
expect(data.networkEffectiveConnectionType).to.satisfy(function (value) {
|
|
198
|
+
return value === null || typeof value === 'string'
|
|
199
|
+
});
|
|
194
200
|
expect(data.bids).to.be.an('array');
|
|
195
201
|
expect(data.version).to.have.all.keys('prebid', 'adapter');
|
|
196
202
|
const bids = data['bids'];
|
|
@@ -231,14 +237,14 @@ describe('onetag', function () {
|
|
|
231
237
|
expect(bid.pubId).to.be.a('string');
|
|
232
238
|
}
|
|
233
239
|
});
|
|
234
|
-
} catch (e) {}
|
|
240
|
+
} catch (e) { }
|
|
235
241
|
it('Returns empty data if no valid requests are passed', function () {
|
|
236
242
|
serverRequest = spec.buildRequests([]);
|
|
237
243
|
let dataString = serverRequest.data;
|
|
238
244
|
try {
|
|
239
245
|
let dataObj = JSON.parse(dataString);
|
|
240
246
|
expect(dataObj.bids).to.be.an('array').that.is.empty;
|
|
241
|
-
} catch (e) {}
|
|
247
|
+
} catch (e) { }
|
|
242
248
|
});
|
|
243
249
|
it('should send GDPR consent data', function () {
|
|
244
250
|
let consentString = 'consentString';
|
|
@@ -287,7 +293,7 @@ describe('onetag', function () {
|
|
|
287
293
|
let dataItem = interpretedResponse[i];
|
|
288
294
|
expect(dataItem).to.include.all.keys('requestId', 'cpm', 'width', 'height', 'ttl', 'creativeId', 'netRevenue', 'currency', 'meta', 'dealId');
|
|
289
295
|
if (dataItem.meta.mediaType === VIDEO) {
|
|
290
|
-
const {context} = find(requestData.bids, (item) => item.bidId === dataItem.requestId);
|
|
296
|
+
const { context } = find(requestData.bids, (item) => item.bidId === dataItem.requestId);
|
|
291
297
|
if (context === INSTREAM) {
|
|
292
298
|
expect(dataItem).to.include.all.keys('videoCacheKey', 'vastUrl');
|
|
293
299
|
expect(dataItem.vastUrl).to.be.a('string');
|
|
@@ -321,7 +327,7 @@ describe('onetag', function () {
|
|
|
321
327
|
describe('getUserSyncs', function () {
|
|
322
328
|
const sync_endpoint = 'https://onetag-sys.com/usync/';
|
|
323
329
|
it('Returns an iframe if iframeEnabled is true', function () {
|
|
324
|
-
const syncs = spec.getUserSyncs({iframeEnabled: true});
|
|
330
|
+
const syncs = spec.getUserSyncs({ iframeEnabled: true });
|
|
325
331
|
expect(syncs).to.be.an('array');
|
|
326
332
|
expect(syncs.length).to.equal(1);
|
|
327
333
|
expect(syncs[0].type).to.equal('iframe');
|
|
@@ -383,16 +389,16 @@ describe('onetag', function () {
|
|
|
383
389
|
expect(isSchainValid(undefined)).to.be.false;
|
|
384
390
|
});
|
|
385
391
|
it('Should return false when schain is missing nodes key', function () {
|
|
386
|
-
const schain = {'otherKey': 'otherValue'};
|
|
392
|
+
const schain = { 'otherKey': 'otherValue' };
|
|
387
393
|
expect(isSchainValid(schain)).to.be.false;
|
|
388
394
|
});
|
|
389
395
|
it('Should return false when schain is missing one of the required SupplyChainNode attribute', function () {
|
|
390
|
-
const missingAsiNode = {'sid': '00001', 'hp': 1};
|
|
391
|
-
const missingSidNode = {'asi': 'indirectseller.com', 'hp': 1};
|
|
392
|
-
const missingHpNode = {'asi': 'indirectseller.com', 'sid': '00001'};
|
|
393
|
-
expect(isSchainValid({'config': {'nodes': [missingAsiNode]}})).to.be.false;
|
|
394
|
-
expect(isSchainValid({'config': {'nodes': [missingSidNode]}})).to.be.false;
|
|
395
|
-
expect(isSchainValid({'config': {'nodes': [missingHpNode]}})).to.be.false;
|
|
396
|
+
const missingAsiNode = { 'sid': '00001', 'hp': 1 };
|
|
397
|
+
const missingSidNode = { 'asi': 'indirectseller.com', 'hp': 1 };
|
|
398
|
+
const missingHpNode = { 'asi': 'indirectseller.com', 'sid': '00001' };
|
|
399
|
+
expect(isSchainValid({ 'config': { 'nodes': [missingAsiNode] } })).to.be.false;
|
|
400
|
+
expect(isSchainValid({ 'config': { 'nodes': [missingSidNode] } })).to.be.false;
|
|
401
|
+
expect(isSchainValid({ 'config': { 'nodes': [missingHpNode] } })).to.be.false;
|
|
396
402
|
});
|
|
397
403
|
it('Should return true when schain contains all required attributes', function () {
|
|
398
404
|
const validSchain = {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getTopics,
|
|
3
|
+
getTopicsData,
|
|
4
|
+
processFpd,
|
|
5
|
+
hasGDPRConsent,
|
|
6
|
+
getCachedTopics,
|
|
7
|
+
receiveMessage,
|
|
8
|
+
topicStorageName
|
|
9
|
+
} from '../../../modules/topicsFpdModule.js';
|
|
2
10
|
import {deepClone, safeJSONParse} from '../../../src/utils.js';
|
|
3
11
|
import {gdprDataHandler} from 'src/adapterManager.js';
|
|
4
12
|
import {getCoreStorageManager} from 'src/storageManager.js';
|
|
@@ -9,14 +17,14 @@ describe('getTopicsData', () => {
|
|
|
9
17
|
topic,
|
|
10
18
|
taxonomyVersion: taxv,
|
|
11
19
|
modelVersion: modelv
|
|
12
|
-
}
|
|
20
|
+
};
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
function byTaxClass(segments) {
|
|
16
24
|
return segments.reduce((memo, segment) => {
|
|
17
25
|
memo[`${segment.ext.segtax}:${segment.ext.segclass}`] = segment;
|
|
18
26
|
return memo;
|
|
19
|
-
}, {})
|
|
27
|
+
}, {});
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
[
|
|
@@ -146,16 +154,16 @@ describe('getTopicsData', () => {
|
|
|
146
154
|
Object.entries(byTaxClass(actual)).forEach(([key, datum]) => {
|
|
147
155
|
sinon.assert.match(datum, expected[key]);
|
|
148
156
|
expect(datum.name).to.equal('mockName');
|
|
149
|
-
})
|
|
157
|
+
});
|
|
150
158
|
});
|
|
151
159
|
|
|
152
160
|
it('should not set name if null', () => {
|
|
153
161
|
getTopicsData(null, topics).forEach((data) => {
|
|
154
162
|
expect(data.hasOwnProperty('name')).to.be.false;
|
|
155
|
-
})
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
})
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
});
|
|
159
167
|
});
|
|
160
168
|
|
|
161
169
|
describe('getTopics', () => {
|
|
@@ -169,11 +177,13 @@ describe('getTopics', () => {
|
|
|
169
177
|
'document that throws on featurePolicy': {
|
|
170
178
|
browsingTopics: sinon.stub(),
|
|
171
179
|
get featurePolicy() {
|
|
172
|
-
throw new Error()
|
|
180
|
+
throw new Error();
|
|
173
181
|
}
|
|
174
182
|
},
|
|
175
183
|
'document that throws on browsingTopics': {
|
|
176
|
-
browsingTopics: sinon.stub().callsFake(() => {
|
|
184
|
+
browsingTopics: sinon.stub().callsFake(() => {
|
|
185
|
+
throw new Error();
|
|
186
|
+
}),
|
|
177
187
|
featurePolicy: {
|
|
178
188
|
allowsFeature: sinon.stub().returns(true)
|
|
179
189
|
}
|
|
@@ -183,11 +193,11 @@ describe('getTopics', () => {
|
|
|
183
193
|
return getTopics(doc).then((topics) => {
|
|
184
194
|
expect(topics).to.eql([]);
|
|
185
195
|
});
|
|
186
|
-
})
|
|
196
|
+
});
|
|
187
197
|
});
|
|
188
198
|
|
|
189
199
|
it('should call `document.browsingTopics` when allowed', () => {
|
|
190
|
-
const topics = ['t1', 't2']
|
|
200
|
+
const topics = ['t1', 't2'];
|
|
191
201
|
return getTopics({
|
|
192
202
|
browsingTopics: sinon.stub().returns(Promise.resolve(topics)),
|
|
193
203
|
featurePolicy: {
|
|
@@ -195,9 +205,9 @@ describe('getTopics', () => {
|
|
|
195
205
|
}
|
|
196
206
|
}).then((actual) => {
|
|
197
207
|
expect(actual).to.eql(topics);
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
})
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|
|
201
211
|
|
|
202
212
|
describe('processFpd', () => {
|
|
203
213
|
const mockData = [
|
|
@@ -244,7 +254,7 @@ describe('Topics Module GDPR consent check', () => {
|
|
|
244
254
|
let gdprDataHdlrStub;
|
|
245
255
|
beforeEach(() => {
|
|
246
256
|
gdprDataHdlrStub = sinon.stub(gdprDataHandler, 'getConsentData');
|
|
247
|
-
})
|
|
257
|
+
});
|
|
248
258
|
|
|
249
259
|
afterEach(() => {
|
|
250
260
|
gdprDataHdlrStub.restore();
|
|
@@ -261,7 +271,7 @@ describe('Topics Module GDPR consent check', () => {
|
|
|
261
271
|
expect(hasGDPRConsent()).to.equal(false);
|
|
262
272
|
});
|
|
263
273
|
|
|
264
|
-
it(
|
|
274
|
+
it('should return true when GDPR doesn\'t apply', () => {
|
|
265
275
|
const consentString = 'CPi8wgAPi8wgAADABBENCrCsAP_AAH_AAAAAISNB7D==';
|
|
266
276
|
const consentConfig = {
|
|
267
277
|
consentString: consentString,
|
|
@@ -365,7 +375,7 @@ describe('getCachedTopics()', () => {
|
|
|
365
375
|
const evt = {
|
|
366
376
|
data: '{"segment":{"domain":"ads.pubmatic.com","topics":[{"configVersion":"chrome.1","modelVersion":"2206021246","taxonomyVersion":"1","topic":165,"version":"chrome.1:1:2206021246"}],"bidder":"pubmatic"},"date":1669743901858}',
|
|
367
377
|
origin: 'https://ads.pubmatic.com'
|
|
368
|
-
}
|
|
378
|
+
};
|
|
369
379
|
|
|
370
380
|
let gdprDataHdlrStub;
|
|
371
381
|
beforeEach(() => {
|
|
@@ -378,14 +388,23 @@ describe('getCachedTopics()', () => {
|
|
|
378
388
|
});
|
|
379
389
|
|
|
380
390
|
it('should return segments for bidder if GDPR consent is true and there is cached segments stored which is not expired', () => {
|
|
381
|
-
|
|
391
|
+
const storedSegments = JSON.stringify(
|
|
392
|
+
[['pubmatic', {
|
|
393
|
+
'2206021246': {
|
|
394
|
+
'ext': {'segtax': 600, 'segclass': '2206021246'},
|
|
395
|
+
'segment': [{'id': '243'}, {'id': '265'}],
|
|
396
|
+
'name': 'ads.pubmatic.com'
|
|
397
|
+
},
|
|
398
|
+
'lastUpdated': new Date().getTime()
|
|
399
|
+
}]]
|
|
400
|
+
);
|
|
382
401
|
storage.setDataInLocalStorage(topicStorageName, storedSegments);
|
|
383
402
|
gdprDataHdlrStub.returns(consentConfig);
|
|
384
403
|
assert.deepEqual(getCachedTopics(), expected);
|
|
385
404
|
});
|
|
386
405
|
|
|
387
406
|
it('should return empty segments for bidder if GDPR consent is true and there is cached segments stored which is expired', () => {
|
|
388
|
-
let storedSegments = '[["pubmatic",{"2206021246":{"ext":{"segtax":600,"segclass":"2206021246"},"segment":[{"id":"243"},{"id":"265"}],"name":"ads.pubmatic.com"},"lastUpdated":
|
|
407
|
+
let storedSegments = '[["pubmatic",{"2206021246":{"ext":{"segtax":600,"segclass":"2206021246"},"segment":[{"id":"243"},{"id":"265"}],"name":"ads.pubmatic.com"},"lastUpdated":10}]]';
|
|
389
408
|
storage.setDataInLocalStorage(topicStorageName, storedSegments);
|
|
390
409
|
gdprDataHdlrStub.returns(consentConfig);
|
|
391
410
|
assert.deepEqual(getCachedTopics(), []);
|
|
@@ -394,7 +413,7 @@ describe('getCachedTopics()', () => {
|
|
|
394
413
|
it('should stored segments if receiveMessage event is triggerred with segment data', () => {
|
|
395
414
|
return processFpd({}, {global: {}}, {data: Promise.resolve(mockData)})
|
|
396
415
|
.then(({global}) => {
|
|
397
|
-
receiveMessage(evt)
|
|
416
|
+
receiveMessage(evt);
|
|
398
417
|
let segments = new Map(safeJSONParse(storage.getDataFromLocalStorage(topicStorageName)));
|
|
399
418
|
expect(segments.has('pubmatic')).to.equal(true);
|
|
400
419
|
});
|
|
@@ -410,4 +429,4 @@ describe('getCachedTopics()', () => {
|
|
|
410
429
|
expect(segments.get('pubmatic')[2206021246].segment.length).to.equal(1);
|
|
411
430
|
});
|
|
412
431
|
});
|
|
413
|
-
})
|
|
432
|
+
});
|