prebid.js 7.47.0 → 7.48.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/ablidaBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/admaticBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adrinoBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.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/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/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectIdSystem.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/dependencies.json +4 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -0
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/impactifyBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/iqmBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/kulturemediaBidAdapter.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/minutemediaplusBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +137 -135
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/orbitsoftBidAdapter.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/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/radsBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/relevantdigitalBidAdapter.js +1 -0
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rtbhouseBidAdapter.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/stvBidAdapter.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/userId.js +1 -1
- package/dist/vdoaiBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- 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/wipesBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/yieldoneBidAdapter.js +1 -1
- package/modules/ablidaBidAdapter.js +4 -5
- package/modules/admaticBidAdapter.js +32 -5
- package/modules/adrinoBidAdapter.js +11 -4
- package/modules/axonixBidAdapter.js +6 -6
- package/modules/connectIdSystem.js +5 -2
- package/modules/criteoBidAdapter.js +3 -5
- package/modules/dspxBidAdapter.js +2 -3
- package/modules/freewheel-sspBidAdapter.js +32 -7
- package/modules/greenbidsRtdProvider.js +110 -0
- package/modules/greenbidsRtdProvider.md +65 -0
- package/modules/impactifyBidAdapter.js +0 -1
- package/modules/iqmBidAdapter.js +1 -2
- package/modules/orbitsoftBidAdapter.js +1 -2
- package/modules/radsBidAdapter.js +3 -4
- package/modules/relevantdigitalBidAdapter.js +198 -0
- package/modules/relevantdigitalBidAdapter.md +117 -0
- package/modules/rtbhouseBidAdapter.js +6 -9
- package/modules/sovrnBidAdapter.js +4 -0
- package/modules/stvBidAdapter.js +4 -5
- package/modules/tripleliftBidAdapter.js +14 -3
- package/modules/ttdBidAdapter.js +73 -71
- package/modules/underdogmediaBidAdapter.js +9 -12
- package/modules/userId/index.js +1 -1
- package/modules/vdoaiBidAdapter.js +2 -3
- package/modules/wipesBidAdapter.js +2 -3
- package/modules/yieldoneBidAdapter.js +3 -4
- package/package.json +1 -1
- package/test/spec/modules/adlooxAdServerVideo_spec.js +18 -35
- package/test/spec/modules/admaticBidAdapter_spec.js +164 -11
- package/test/spec/modules/adrinoBidAdapter_spec.js +50 -2
- package/test/spec/modules/connectIdSystem_spec.js +4 -4
- package/test/spec/modules/criteoBidAdapter_spec.js +56 -0
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +31 -2
- package/test/spec/modules/greenbidsRtdProvider_spec.js +210 -0
- package/test/spec/modules/relevantdigitalBidAdapter_spec.js +295 -0
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +22 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +65 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +53 -8
- package/test/spec/modules/ttdBidAdapter_spec.js +20 -0
- package/test/spec/ortbConverter/userId_spec.js +12 -0
- package/test/spec/modules/realvuAnalyticsAdapter_spec.js +0 -189
|
@@ -43,7 +43,7 @@ describe('adrinoBidAdapter', function () {
|
|
|
43
43
|
|
|
44
44
|
it('should return false when unsupported media type is requested', function () {
|
|
45
45
|
const bid = { ...validBid };
|
|
46
|
-
bid.mediaTypes = {
|
|
46
|
+
bid.mediaTypes = { video: {} };
|
|
47
47
|
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -54,7 +54,46 @@ describe('adrinoBidAdapter', function () {
|
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
describe('
|
|
57
|
+
describe('buildBannerRequest', function () {
|
|
58
|
+
const bidRequest = {
|
|
59
|
+
bidder: 'adrino',
|
|
60
|
+
params: {
|
|
61
|
+
hash: 'abcdef123456'
|
|
62
|
+
},
|
|
63
|
+
mediaTypes: {
|
|
64
|
+
banner: {
|
|
65
|
+
sizes: [[300, 250], [970, 250]]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
sizes: [[300, 250], [970, 250]],
|
|
69
|
+
userId: { criteoId: '2xqi3F94aHdwWnM3', pubcid: '3ec0b202-7697' },
|
|
70
|
+
adUnitCode: 'adunit-code-2',
|
|
71
|
+
bidId: '12345678901234',
|
|
72
|
+
bidderRequestId: '98765432109876',
|
|
73
|
+
auctionId: '01234567891234',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
it('should build the request correctly', function () {
|
|
77
|
+
const result = spec.buildRequests(
|
|
78
|
+
[ bidRequest ],
|
|
79
|
+
{ refererInfo: { page: 'http://example.com/' } }
|
|
80
|
+
);
|
|
81
|
+
expect(result.length).to.equal(1);
|
|
82
|
+
expect(result[0].method).to.equal('POST');
|
|
83
|
+
expect(result[0].url).to.equal('https://prd-prebid-bidder.adrino.io/bidder/bids/');
|
|
84
|
+
expect(result[0].data[0].bidId).to.equal('12345678901234');
|
|
85
|
+
expect(result[0].data[0].placementHash).to.equal('abcdef123456');
|
|
86
|
+
expect(result[0].data[0].referer).to.equal('http://example.com/');
|
|
87
|
+
expect(result[0].data[0].userAgent).to.equal(navigator.userAgent);
|
|
88
|
+
expect(result[0].data[0]).to.have.property('bannerParams');
|
|
89
|
+
expect(result[0].data[0].bannerParams.sizes.length).to.equal(2);
|
|
90
|
+
expect(result[0].data[0]).to.have.property('userId');
|
|
91
|
+
expect(result[0].data[0].userId.criteoId).to.equal('2xqi3F94aHdwWnM3');
|
|
92
|
+
expect(result[0].data[0].userId.pubcid).to.equal('3ec0b202-7697');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('buildNativeRequest', function () {
|
|
58
97
|
const bidRequest = {
|
|
59
98
|
bidder: 'adrino',
|
|
60
99
|
params: {
|
|
@@ -71,6 +110,15 @@ describe('adrinoBidAdapter', function () {
|
|
|
71
110
|
}
|
|
72
111
|
}
|
|
73
112
|
},
|
|
113
|
+
nativeParams: {
|
|
114
|
+
title: {
|
|
115
|
+
required: true
|
|
116
|
+
},
|
|
117
|
+
image: {
|
|
118
|
+
required: true,
|
|
119
|
+
sizes: [[300, 150], [300, 210]]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
74
122
|
userId: { criteoId: '2xqi3F94aHdwWnM3', pubcid: '3ec0b202-7697' },
|
|
75
123
|
adUnitCode: 'adunit-code',
|
|
76
124
|
bidId: '12345678901234',
|
|
@@ -86,7 +86,7 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
86
86
|
{
|
|
87
87
|
detail: 'cookie data over local storage data',
|
|
88
88
|
cookie: '{"connectId":"foo"}',
|
|
89
|
-
localStorage: {connectId: 'bar'},
|
|
89
|
+
localStorage: JSON.stringify({connectId: 'bar'}),
|
|
90
90
|
expected: {connectId: 'foo'}
|
|
91
91
|
},
|
|
92
92
|
{
|
|
@@ -98,7 +98,7 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
98
98
|
{
|
|
99
99
|
detail: 'local storage data if only it local storage data exists',
|
|
100
100
|
cookie: undefined,
|
|
101
|
-
localStorage: {connectId: 'bar'},
|
|
101
|
+
localStorage: JSON.stringify({connectId: 'bar'}),
|
|
102
102
|
expected: {connectId: 'bar'}
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -441,10 +441,10 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
441
441
|
const dateNowStub = sinon.stub(Date, 'now');
|
|
442
442
|
dateNowStub.returns(0);
|
|
443
443
|
const upsResponse = {connectid: 'barfoo'};
|
|
444
|
-
const expectedStoredData = {
|
|
444
|
+
const expectedStoredData = JSON.stringify({
|
|
445
445
|
connectid: 'barfoo',
|
|
446
446
|
__expires: 60 * 60 * 24 * 14 * 1000
|
|
447
|
-
};
|
|
447
|
+
});
|
|
448
448
|
invokeGetIdAPI({
|
|
449
449
|
puid: PUBLISHER_USER_ID,
|
|
450
450
|
pixelId: PIXEL_ID
|
|
@@ -728,6 +728,62 @@ describe('The Criteo bidding adapter', function () {
|
|
|
728
728
|
expect(ortbRequest.slots[0].native).to.equal(true);
|
|
729
729
|
});
|
|
730
730
|
|
|
731
|
+
it('should map ortb native assets to slot ext assets', function () {
|
|
732
|
+
const assets = [{
|
|
733
|
+
required: 1,
|
|
734
|
+
id: 1,
|
|
735
|
+
img: {
|
|
736
|
+
type: 3,
|
|
737
|
+
wmin: 100,
|
|
738
|
+
hmin: 100,
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
required: 1,
|
|
743
|
+
id: 2,
|
|
744
|
+
title: {
|
|
745
|
+
len: 140,
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
required: 1,
|
|
750
|
+
id: 3,
|
|
751
|
+
data: {
|
|
752
|
+
type: 1,
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
required: 0,
|
|
757
|
+
id: 4,
|
|
758
|
+
data: {
|
|
759
|
+
type: 2,
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
required: 0,
|
|
764
|
+
id: 5,
|
|
765
|
+
img: {
|
|
766
|
+
type: 1,
|
|
767
|
+
wmin: 20,
|
|
768
|
+
hmin: 20,
|
|
769
|
+
}
|
|
770
|
+
}];
|
|
771
|
+
const bidRequests = [
|
|
772
|
+
{
|
|
773
|
+
nativeOrtbRequest: {
|
|
774
|
+
assets: assets
|
|
775
|
+
},
|
|
776
|
+
params: {
|
|
777
|
+
nativeCallback: function () { }
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
];
|
|
781
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
782
|
+
const ortbRequest = request.data;
|
|
783
|
+
expect(ortbRequest.slots[0].native).to.equal(true);
|
|
784
|
+
expect(ortbRequest.slots[0].ext.assets).to.deep.equal(assets);
|
|
785
|
+
});
|
|
786
|
+
|
|
731
787
|
it('should properly build a networkId request', function () {
|
|
732
788
|
const bidderRequest = {
|
|
733
789
|
refererInfo: {
|
|
@@ -224,12 +224,41 @@ describe('freewheelSSP BidAdapter Test', () => {
|
|
|
224
224
|
let syncOptions = {
|
|
225
225
|
'pixelEnabled': true
|
|
226
226
|
}
|
|
227
|
-
const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null);
|
|
227
|
+
const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null, null);
|
|
228
228
|
expect(userSyncs).to.deep.equal([{
|
|
229
229
|
type: 'image',
|
|
230
230
|
url: 'https://ads.stickyadstv.com/auto-user-sync?gdpr=1&gdpr_consent=1FW-SSP-gdprConsent-'
|
|
231
231
|
}]);
|
|
232
232
|
});
|
|
233
|
+
|
|
234
|
+
it('should add gpp information to the request via bidderRequest.gppConsent', function () {
|
|
235
|
+
let consentString = 'abc1234';
|
|
236
|
+
let bidderRequest = {
|
|
237
|
+
'gppConsent': {
|
|
238
|
+
'gppString': consentString,
|
|
239
|
+
'applicableSections': [8]
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
244
|
+
const payload = request[0].data;
|
|
245
|
+
|
|
246
|
+
expect(payload.gpp).to.equal(consentString);
|
|
247
|
+
expect(payload.gpp_sid).to.deep.equal([8]);
|
|
248
|
+
|
|
249
|
+
let gppConsent = {
|
|
250
|
+
'applicableSections': [8],
|
|
251
|
+
'gppString': consentString
|
|
252
|
+
}
|
|
253
|
+
let syncOptions = {
|
|
254
|
+
'pixelEnabled': true
|
|
255
|
+
}
|
|
256
|
+
const userSyncs = spec.getUserSyncs(syncOptions, null, null, null, gppConsent);
|
|
257
|
+
expect(userSyncs).to.deep.equal([{
|
|
258
|
+
type: 'image',
|
|
259
|
+
url: 'https://ads.stickyadstv.com/auto-user-sync?gpp=abc1234&gpp_sid[]=8'
|
|
260
|
+
}]);
|
|
261
|
+
});
|
|
233
262
|
})
|
|
234
263
|
|
|
235
264
|
describe('buildRequestsForVideo', () => {
|
|
@@ -318,7 +347,7 @@ describe('freewheelSSP BidAdapter Test', () => {
|
|
|
318
347
|
let syncOptions = {
|
|
319
348
|
'pixelEnabled': true
|
|
320
349
|
}
|
|
321
|
-
const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null);
|
|
350
|
+
const userSyncs = spec.getUserSyncs(syncOptions, null, gdprConsent, null, null);
|
|
322
351
|
expect(userSyncs).to.deep.equal([{
|
|
323
352
|
type: 'image',
|
|
324
353
|
url: 'https://ads.stickyadstv.com/auto-user-sync?gdpr=1&gdpr_consent=1FW-SSP-gdprConsent-'
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import {
|
|
4
|
+
deepClone,
|
|
5
|
+
} from '../../../src/utils.js';
|
|
6
|
+
import {
|
|
7
|
+
greenbidsSubmodule
|
|
8
|
+
} from 'modules/greenbidsRtdProvider.js';
|
|
9
|
+
|
|
10
|
+
describe('greenbidsRtdProvider', () => {
|
|
11
|
+
let server;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
server = sinon.createFakeServer();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
server.restore();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const endPoint = 'europe-west1-greenbids-357713.cloudfunctions.net';
|
|
22
|
+
|
|
23
|
+
const SAMPLE_MODULE_CONFIG = {
|
|
24
|
+
params: {
|
|
25
|
+
pbuid: '12345',
|
|
26
|
+
timeout: 200,
|
|
27
|
+
targetTPR: 0.95
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const SAMPLE_REQUEST_BIDS_CONFIG_OBJ = {
|
|
32
|
+
adUnits: [
|
|
33
|
+
{
|
|
34
|
+
code: 'adUnit1',
|
|
35
|
+
bids: [
|
|
36
|
+
{ bidder: 'appnexus', params: {} },
|
|
37
|
+
{ bidder: 'rubicon', params: {} },
|
|
38
|
+
{ bidder: 'ix', params: {} }
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
code: 'adUnit2',
|
|
43
|
+
bids: [
|
|
44
|
+
{ bidder: 'appnexus', params: {} },
|
|
45
|
+
{ bidder: 'rubicon', params: {} },
|
|
46
|
+
{ bidder: 'openx', params: {} }
|
|
47
|
+
]
|
|
48
|
+
}]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const SAMPLE_RESPONSE_ADUNITS = [
|
|
52
|
+
{
|
|
53
|
+
code: 'adUnit1',
|
|
54
|
+
bidders: {
|
|
55
|
+
'appnexus': true,
|
|
56
|
+
'rubicon': false,
|
|
57
|
+
'ix': true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
code: 'adUnit2',
|
|
62
|
+
bidders: {
|
|
63
|
+
'appnexus': false,
|
|
64
|
+
'rubicon': true,
|
|
65
|
+
'openx': true
|
|
66
|
+
}
|
|
67
|
+
}];
|
|
68
|
+
|
|
69
|
+
describe('init', () => {
|
|
70
|
+
it('should return true and set rtdOptions if pbuid is present', () => {
|
|
71
|
+
const result = greenbidsSubmodule.init(SAMPLE_MODULE_CONFIG);
|
|
72
|
+
expect(result).to.be.true;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should return false if pbuid is not present', () => {
|
|
76
|
+
const result = greenbidsSubmodule.init({ params: {} });
|
|
77
|
+
expect(result).to.be.false;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('updateAdUnitsBasedOnResponse', () => {
|
|
82
|
+
it('should update ad units based on response', () => {
|
|
83
|
+
const adUnits = JSON.parse(JSON.stringify(SAMPLE_REQUEST_BIDS_CONFIG_OBJ.adUnits));
|
|
84
|
+
greenbidsSubmodule.updateAdUnitsBasedOnResponse(adUnits, SAMPLE_RESPONSE_ADUNITS);
|
|
85
|
+
|
|
86
|
+
expect(adUnits[0].bids).to.have.length(2);
|
|
87
|
+
expect(adUnits[1].bids).to.have.length(2);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('findMatchingAdUnit', () => {
|
|
92
|
+
it('should find matching ad unit by code', () => {
|
|
93
|
+
const matchingAdUnit = greenbidsSubmodule.findMatchingAdUnit(SAMPLE_RESPONSE_ADUNITS, 'adUnit1');
|
|
94
|
+
expect(matchingAdUnit).to.deep.equal(SAMPLE_RESPONSE_ADUNITS[0]);
|
|
95
|
+
});
|
|
96
|
+
it('should return undefined if no matching ad unit is found', () => {
|
|
97
|
+
const matchingAdUnit = greenbidsSubmodule.findMatchingAdUnit(SAMPLE_RESPONSE_ADUNITS, 'nonexistent');
|
|
98
|
+
expect(matchingAdUnit).to.be.undefined;
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
describe('removeFalseBidders', () => {
|
|
103
|
+
it('should remove bidders with false value', () => {
|
|
104
|
+
const adUnit = JSON.parse(JSON.stringify(SAMPLE_REQUEST_BIDS_CONFIG_OBJ.adUnits[0]));
|
|
105
|
+
const matchingAdUnit = SAMPLE_RESPONSE_ADUNITS[0];
|
|
106
|
+
greenbidsSubmodule.removeFalseBidders(adUnit, matchingAdUnit);
|
|
107
|
+
expect(adUnit.bids).to.have.length(2);
|
|
108
|
+
expect(adUnit.bids.map((bid) => bid.bidder)).to.not.include('rubicon');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('getFalseBidders', () => {
|
|
113
|
+
it('should return an array of false bidders', () => {
|
|
114
|
+
const bidders = {
|
|
115
|
+
appnexus: true,
|
|
116
|
+
rubicon: false,
|
|
117
|
+
ix: true,
|
|
118
|
+
openx: false
|
|
119
|
+
};
|
|
120
|
+
const falseBidders = greenbidsSubmodule.getFalseBidders(bidders);
|
|
121
|
+
expect(falseBidders).to.have.length(2);
|
|
122
|
+
expect(falseBidders).to.include('rubicon');
|
|
123
|
+
expect(falseBidders).to.include('openx');
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('getBidRequestData', () => {
|
|
128
|
+
it('Callback is called if the server responds a 200 within the time limit', (done) => {
|
|
129
|
+
let requestBids = deepClone(SAMPLE_REQUEST_BIDS_CONFIG_OBJ);
|
|
130
|
+
let callback = sinon.stub();
|
|
131
|
+
|
|
132
|
+
greenbidsSubmodule.getBidRequestData(requestBids, callback, SAMPLE_MODULE_CONFIG);
|
|
133
|
+
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
server.requests[0].respond(
|
|
136
|
+
200,
|
|
137
|
+
{'Content-Type': 'application/json'},
|
|
138
|
+
JSON.stringify(SAMPLE_RESPONSE_ADUNITS)
|
|
139
|
+
);
|
|
140
|
+
done();
|
|
141
|
+
}, 50);
|
|
142
|
+
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
const requestUrl = new URL(server.requests[0].url);
|
|
145
|
+
expect(requestUrl.host).to.be.eq(endPoint);
|
|
146
|
+
expect(requestBids.adUnits[0].bids).to.have.length(2);
|
|
147
|
+
expect(requestBids.adUnits[0].bids.map((bid) => bid.bidder)).to.not.include('rubicon');
|
|
148
|
+
expect(requestBids.adUnits[0].bids.map((bid) => bid.bidder)).to.include('ix');
|
|
149
|
+
expect(requestBids.adUnits[0].bids.map((bid) => bid.bidder)).to.include('appnexus');
|
|
150
|
+
expect(requestBids.adUnits[1].bids).to.have.length(2);
|
|
151
|
+
expect(requestBids.adUnits[1].bids.map((bid) => bid.bidder)).to.not.include('appnexus');
|
|
152
|
+
expect(requestBids.adUnits[1].bids.map((bid) => bid.bidder)).to.include('rubicon');
|
|
153
|
+
expect(requestBids.adUnits[1].bids.map((bid) => bid.bidder)).to.include('openx');
|
|
154
|
+
expect(callback.calledOnce).to.be.true;
|
|
155
|
+
}, 60);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
describe('getBidRequestData', () => {
|
|
160
|
+
it('Nothing changes if the server times out but still the callback is called', (done) => {
|
|
161
|
+
let requestBids = deepClone(SAMPLE_REQUEST_BIDS_CONFIG_OBJ);
|
|
162
|
+
let callback = sinon.stub();
|
|
163
|
+
|
|
164
|
+
greenbidsSubmodule.getBidRequestData(requestBids, callback, SAMPLE_MODULE_CONFIG);
|
|
165
|
+
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
server.requests[0].respond(
|
|
168
|
+
200,
|
|
169
|
+
{'Content-Type': 'application/json'},
|
|
170
|
+
JSON.stringify(SAMPLE_RESPONSE_ADUNITS)
|
|
171
|
+
);
|
|
172
|
+
done();
|
|
173
|
+
}, 300);
|
|
174
|
+
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
const requestUrl = new URL(server.requests[0].url);
|
|
177
|
+
expect(requestUrl.host).to.be.eq(endPoint);
|
|
178
|
+
expect(requestBids.adUnits[0].bids).to.have.length(3);
|
|
179
|
+
expect(requestBids.adUnits[1].bids).to.have.length(3);
|
|
180
|
+
expect(callback.calledOnce).to.be.true;
|
|
181
|
+
}, 200);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
describe('getBidRequestData', () => {
|
|
186
|
+
it('callback is called if the server responds a 500 error within the time limit and no changes are made', (done) => {
|
|
187
|
+
let requestBids = deepClone(SAMPLE_REQUEST_BIDS_CONFIG_OBJ);
|
|
188
|
+
let callback = sinon.stub();
|
|
189
|
+
|
|
190
|
+
greenbidsSubmodule.getBidRequestData(requestBids, callback, SAMPLE_MODULE_CONFIG);
|
|
191
|
+
|
|
192
|
+
setTimeout(() => {
|
|
193
|
+
server.requests[0].respond(
|
|
194
|
+
500,
|
|
195
|
+
{'Content-Type': 'application/json'},
|
|
196
|
+
JSON.stringify({'failure': 'fail'})
|
|
197
|
+
);
|
|
198
|
+
done();
|
|
199
|
+
}, 50);
|
|
200
|
+
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
const requestUrl = new URL(server.requests[0].url);
|
|
203
|
+
expect(requestUrl.host).to.be.eq(endPoint);
|
|
204
|
+
expect(requestBids.adUnits[0].bids).to.have.length(3);
|
|
205
|
+
expect(requestBids.adUnits[1].bids).to.have.length(3);
|
|
206
|
+
expect(callback.calledOnce).to.be.true;
|
|
207
|
+
}, 60);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|