prebid.js 7.3.0 → 7.6.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/.circleci/config.yml +11 -6
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adnuntiusBidAdapter.js +1 -1
- package/dist/adotBidAdapter.js +1 -1
- package/dist/adpod.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adrinoBidAdapter.js +1 -1
- package/dist/adtelligentBidAdapter.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/atsAnalyticsAdapter.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/byDataAnalyticsAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- 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/debugging-standalone.js +1 -1
- package/dist/debugging.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/gdprEnforcement.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/hadronIdSystem.js +1 -1
- package/dist/hadronRtdProvider.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imRtdProvider.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/kargoAnalyticsAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.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/missenaBidAdapter.js +1 -1
- package/dist/newspassidBidAdapter.js +1 -0
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +131 -127
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxOrtbBidAdapter.js +1 -0
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +2 -2
- package/dist/priceFloors.js +1 -1
- package/dist/pubCommonId.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/rasBidAdapter.js +1 -0
- 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/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharedIdSystem.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -0
- package/dist/sizeMappingV2.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/taboolaBidAdapter.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/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/ventesBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vrtcalBidAdapter.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/gulpfile.js +1 -1
- package/karma.conf.maker.js +3 -1
- package/modules/adgenerationBidAdapter.js +24 -1
- package/modules/adnuntiusBidAdapter.js +26 -8
- package/modules/adotBidAdapter.js +13 -4
- package/modules/adrinoBidAdapter.js +10 -2
- package/modules/adrinoBidAdapter.md +6 -0
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/appnexusBidAdapter.js +3 -3
- package/modules/atsAnalyticsAdapter.js +4 -5
- package/modules/byDataAnalyticsAdapter.js +172 -74
- package/modules/byDataAnalyticsAdapter.md +5 -6
- package/modules/consumableBidAdapter.js +12 -1
- package/modules/criteoBidAdapter.js +7 -1
- package/modules/cwireBidAdapter.md +1 -1
- package/modules/debugging/bidInterceptor.js +1 -1
- package/modules/debugging/index.js +2 -1
- package/modules/eplanningBidAdapter.js +82 -97
- package/modules/gdprEnforcement.js +8 -14
- package/modules/gridNMBidAdapter.js +45 -4
- package/modules/hadronAnalyticsAdapter.md +5 -5
- package/modules/hadronIdSystem.js +18 -5
- package/modules/hadronIdSystem.md +15 -11
- package/modules/hadronRtdProvider.js +14 -1
- package/modules/hadronRtdProvider.md +17 -13
- package/modules/imRtdProvider.js +0 -8
- package/modules/insticatorBidAdapter.js +9 -0
- package/modules/ixBidAdapter.js +462 -58
- package/modules/ixBidAdapter.md +95 -5
- package/modules/kargoAnalyticsAdapter.js +88 -6
- package/modules/kargoAnalyticsAdapter.md +33 -0
- package/modules/kargoBidAdapter.js +1 -2
- package/modules/minutemediaBidAdapter.js +1 -0
- package/modules/missenaBidAdapter.js +20 -2
- package/modules/newspassidBidAdapter.js +649 -0
- package/modules/nextMillenniumBidAdapter.js +17 -1
- package/modules/oguryBidAdapter.js +2 -0
- package/modules/openxBidAdapter.md +3 -1
- package/modules/openxOrtbBidAdapter.js +349 -0
- package/modules/openxOrtbBidAdapter.md +105 -0
- package/modules/priceFloors.js +1 -1
- package/modules/pubCommonId.js +1 -2
- package/modules/pubxaiAnalyticsAdapter.js +6 -1
- package/modules/rasBidAdapter.js +149 -0
- package/modules/rasBidAdapter.md +50 -0
- package/modules/readpeakBidAdapter.js +15 -6
- package/modules/relaidoBidAdapter.js +19 -4
- package/modules/seedtagBidAdapter.js +37 -1
- package/modules/sharedIdSystem.js +11 -5
- package/modules/sharethroughBidAdapter.js +9 -24
- package/modules/shinezBidAdapter.js +435 -0
- package/modules/shinezBidAdapter.md +76 -0
- package/modules/taboolaBidAdapter.js +1 -1
- package/modules/taboolaBidAdapter.md +3 -3
- package/modules/ventesBidAdapter.js +1 -1
- package/modules/ventesBidAdapter.md +1 -1
- package/modules/vrtcalBidAdapter.js +35 -0
- package/package.json +1 -1
- package/plugins/pbjsGlobals.js +2 -1
- package/src/storageManager.js +4 -5
- package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -4
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +126 -14
- package/test/spec/modules/adotBidAdapter_spec.js +12 -9
- package/test/spec/modules/adrinoBidAdapter_spec.js +22 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
- package/test/spec/modules/byDataAnalyticsAdapter_spec.js +74 -24
- package/test/spec/modules/consumableBidAdapter_spec.js +75 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
- package/test/spec/modules/debugging_mod_spec.js +7 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +58 -18
- package/test/spec/modules/gdprEnforcement_spec.js +53 -100
- package/test/spec/modules/gridNMBidAdapter_spec.js +32 -0
- package/test/spec/modules/hadronIdSystem_spec.js +2 -2
- package/test/spec/modules/imRtdProvider_spec.js +0 -1
- package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
- package/test/spec/modules/ixBidAdapter_spec.js +470 -10
- package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
- package/test/spec/modules/minutemediaBidAdapter_spec.js +3 -0
- package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
- package/test/spec/modules/newspassidBidAdapter_spec.js +1793 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +20 -0
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +5 -0
- package/test/spec/modules/rasBidAdapter_spec.js +190 -0
- package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
- package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
- package/test/spec/modules/seedtagBidAdapter_spec.js +29 -0
- package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
- package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
- package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
- package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
- package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
- package/webpack.conf.js +1 -1
|
@@ -0,0 +1,1303 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {spec, REQUEST_URL, SYNC_URL, DEFAULT_PH} from 'modules/openxOrtbBidAdapter.js';
|
|
3
|
+
import {newBidder} from 'src/adapters/bidderFactory.js';
|
|
4
|
+
import {BANNER, VIDEO} from 'src/mediaTypes.js';
|
|
5
|
+
import {config} from 'src/config.js';
|
|
6
|
+
import * as utils from 'src/utils.js';
|
|
7
|
+
|
|
8
|
+
const DEFAULT_SYNC = SYNC_URL + '?ph=' + DEFAULT_PH;
|
|
9
|
+
|
|
10
|
+
describe('OpenxRtbAdapter', function () {
|
|
11
|
+
const adapter = newBidder(spec);
|
|
12
|
+
|
|
13
|
+
describe('inherited functions', function () {
|
|
14
|
+
it('exists and is a function', function () {
|
|
15
|
+
expect(adapter.callBids).to.exist.and.to.be.a('function');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('isBidRequestValid()', function () {
|
|
20
|
+
describe('when request is for a banner ad', function () {
|
|
21
|
+
let bannerBid;
|
|
22
|
+
beforeEach(function () {
|
|
23
|
+
bannerBid = {
|
|
24
|
+
bidder: 'openx',
|
|
25
|
+
params: {},
|
|
26
|
+
adUnitCode: 'adunit-code',
|
|
27
|
+
mediaTypes: {banner: {}},
|
|
28
|
+
sizes: [[300, 250], [300, 600]],
|
|
29
|
+
bidId: '30b31c1838de1e',
|
|
30
|
+
bidderRequestId: '22edbae2733bf6',
|
|
31
|
+
auctionId: '1d1a030790a475'
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return false when there is no delivery domain', function () {
|
|
36
|
+
bannerBid.params = {'unit': '12345678'};
|
|
37
|
+
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('when there is a delivery domain', function () {
|
|
41
|
+
beforeEach(function () {
|
|
42
|
+
bannerBid.params = {delDomain: 'test-delivery-domain'}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should return false when there is no ad unit id and size', function () {
|
|
46
|
+
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should return true if there is an adunit id ', function () {
|
|
50
|
+
bannerBid.params.unit = '12345678';
|
|
51
|
+
expect(spec.isBidRequestValid(bannerBid)).to.equal(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should return true if there is no adunit id and sizes are defined', function () {
|
|
55
|
+
bannerBid.mediaTypes.banner.sizes = [720, 90];
|
|
56
|
+
expect(spec.isBidRequestValid(bannerBid)).to.equal(true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should return false if no sizes are defined ', function () {
|
|
60
|
+
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should return false if sizes empty ', function () {
|
|
64
|
+
bannerBid.mediaTypes.banner.sizes = [];
|
|
65
|
+
expect(spec.isBidRequestValid(bannerBid)).to.equal(false);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('when request is for a multiformat ad', function () {
|
|
71
|
+
describe('and request config uses mediaTypes video and banner', () => {
|
|
72
|
+
const multiformatBid = {
|
|
73
|
+
bidder: 'openx',
|
|
74
|
+
params: {
|
|
75
|
+
unit: '12345678',
|
|
76
|
+
delDomain: 'test-del-domain'
|
|
77
|
+
},
|
|
78
|
+
adUnitCode: 'adunit-code',
|
|
79
|
+
mediaTypes: {
|
|
80
|
+
banner: {
|
|
81
|
+
sizes: [[300, 250]]
|
|
82
|
+
},
|
|
83
|
+
video: {
|
|
84
|
+
playerSize: [300, 250]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
bidId: '30b31c1838de1e',
|
|
88
|
+
bidderRequestId: '22edbae2733bf6',
|
|
89
|
+
auctionId: '1d1a030790a475',
|
|
90
|
+
transactionId: '4008d88a-8137-410b-aa35-fbfdabcb478e'
|
|
91
|
+
};
|
|
92
|
+
it('should return true multisize when required params found', function () {
|
|
93
|
+
expect(spec.isBidRequestValid(multiformatBid)).to.equal(true);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('when request is for a video ad', function () {
|
|
99
|
+
describe('and request config uses mediaTypes', () => {
|
|
100
|
+
const videoBidWithMediaTypes = {
|
|
101
|
+
bidder: 'openx',
|
|
102
|
+
params: {
|
|
103
|
+
unit: '12345678',
|
|
104
|
+
delDomain: 'test-del-domain'
|
|
105
|
+
},
|
|
106
|
+
adUnitCode: 'adunit-code',
|
|
107
|
+
mediaTypes: {
|
|
108
|
+
video: {
|
|
109
|
+
playerSize: [640, 480]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
bidId: '30b31c1838de1e',
|
|
113
|
+
bidderRequestId: '22edbae2733bf6',
|
|
114
|
+
auctionId: '1d1a030790a475',
|
|
115
|
+
transactionId: '4008d88a-8137-410b-aa35-fbfdabcb478e'
|
|
116
|
+
};
|
|
117
|
+
it('should return true when required params found', function () {
|
|
118
|
+
expect(spec.isBidRequestValid(videoBidWithMediaTypes)).to.equal(true);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should return false when required params are not passed', function () {
|
|
122
|
+
let videoBidWithMediaTypes = Object.assign({}, videoBidWithMediaTypes);
|
|
123
|
+
videoBidWithMediaTypes.params = {};
|
|
124
|
+
expect(spec.isBidRequestValid(videoBidWithMediaTypes)).to.equal(false);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe('and request config uses both delDomain and platform', () => {
|
|
128
|
+
const videoBidWithDelDomainAndPlatform = {
|
|
129
|
+
bidder: 'openx',
|
|
130
|
+
params: {
|
|
131
|
+
unit: '12345678',
|
|
132
|
+
delDomain: 'test-del-domain',
|
|
133
|
+
platform: '1cabba9e-cafe-3665-beef-f00f00f00f00'
|
|
134
|
+
},
|
|
135
|
+
adUnitCode: 'adunit-code',
|
|
136
|
+
mediaTypes: {
|
|
137
|
+
video: {
|
|
138
|
+
playerSize: [640, 480]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
bidId: '30b31c1838de1e',
|
|
142
|
+
bidderRequestId: '22edbae2733bf6',
|
|
143
|
+
auctionId: '1d1a030790a475',
|
|
144
|
+
transactionId: '4008d88a-8137-410b-aa35-fbfdabcb478e'
|
|
145
|
+
};
|
|
146
|
+
it('should return true when required params found', function () {
|
|
147
|
+
expect(spec.isBidRequestValid(videoBidWithDelDomainAndPlatform)).to.equal(true);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should return false when required params are not passed', function () {
|
|
151
|
+
let videoBidWithMediaTypes = Object.assign({}, videoBidWithDelDomainAndPlatform);
|
|
152
|
+
videoBidWithMediaTypes.params = {};
|
|
153
|
+
expect(spec.isBidRequestValid(videoBidWithMediaTypes)).to.equal(false);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
describe('and request config uses mediaType', () => {
|
|
157
|
+
const videoBidWithMediaType = {
|
|
158
|
+
'bidder': 'openx',
|
|
159
|
+
'params': {
|
|
160
|
+
'unit': '12345678',
|
|
161
|
+
'delDomain': 'test-del-domain'
|
|
162
|
+
},
|
|
163
|
+
'adUnitCode': 'adunit-code',
|
|
164
|
+
'mediaType': 'video',
|
|
165
|
+
'sizes': [640, 480],
|
|
166
|
+
'bidId': '30b31c1838de1e',
|
|
167
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
168
|
+
'auctionId': '1d1a030790a475',
|
|
169
|
+
'transactionId': '4008d88a-8137-410b-aa35-fbfdabcb478e'
|
|
170
|
+
};
|
|
171
|
+
it('should return true when required params found', function () {
|
|
172
|
+
expect(spec.isBidRequestValid(videoBidWithMediaType)).to.equal(true);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('should return false when required params are not passed', function () {
|
|
176
|
+
let videoBidWithMediaType = Object.assign({}, videoBidWithMediaType);
|
|
177
|
+
delete videoBidWithMediaType.params;
|
|
178
|
+
videoBidWithMediaType.params = {};
|
|
179
|
+
expect(spec.isBidRequestValid(videoBidWithMediaType)).to.equal(false);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
describe('buildRequests()', function () {
|
|
186
|
+
let bidRequestsWithMediaTypes;
|
|
187
|
+
let bidRequestsWithPlatform;
|
|
188
|
+
let mockBidderRequest;
|
|
189
|
+
|
|
190
|
+
beforeEach(function () {
|
|
191
|
+
mockBidderRequest = {refererInfo: {}};
|
|
192
|
+
|
|
193
|
+
bidRequestsWithMediaTypes = [{
|
|
194
|
+
bidder: 'openx',
|
|
195
|
+
params: {
|
|
196
|
+
unit: '11',
|
|
197
|
+
delDomain: 'test-del-domain',
|
|
198
|
+
platform: '1cabba9e-cafe-3665-beef-f00f00f00f00',
|
|
199
|
+
},
|
|
200
|
+
adUnitCode: '/adunit-code/test-path',
|
|
201
|
+
mediaTypes: {
|
|
202
|
+
banner: {
|
|
203
|
+
sizes: [[300, 250], [300, 600]]
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
bidId: 'test-bid-id-1',
|
|
207
|
+
bidderRequestId: 'test-bid-request-1',
|
|
208
|
+
auctionId: 'test-auction-1',
|
|
209
|
+
transactionId: 'test-transactionId-1'
|
|
210
|
+
}, {
|
|
211
|
+
bidder: 'openx',
|
|
212
|
+
params: {
|
|
213
|
+
unit: '22',
|
|
214
|
+
delDomain: 'test-del-domain',
|
|
215
|
+
platform: '1cabba9e-cafe-3665-beef-f00f00f00f00',
|
|
216
|
+
},
|
|
217
|
+
adUnitCode: 'adunit-code',
|
|
218
|
+
mediaTypes: {
|
|
219
|
+
video: {
|
|
220
|
+
playerSize: [640, 480]
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
bidId: 'test-bid-id-2',
|
|
224
|
+
bidderRequestId: 'test-bid-request-2',
|
|
225
|
+
auctionId: 'test-auction-2',
|
|
226
|
+
transactionId: 'test-transactionId-2'
|
|
227
|
+
}];
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
context('common requests checks', function() {
|
|
231
|
+
it('should send bid request to openx url via POST', function () {
|
|
232
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
233
|
+
expect(request[0].url).to.equal(REQUEST_URL);
|
|
234
|
+
expect(request[0].method).to.equal('POST');
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('should send delivery domain, if available', function () {
|
|
238
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
239
|
+
expect(request[0].data.ext.delDomain).to.equal(bidRequestsWithMediaTypes[0].params.delDomain);
|
|
240
|
+
expect(request[0].data.ext.platformId).to.be.undefined;
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should send platform id, if available', function () {
|
|
244
|
+
bidRequestsWithMediaTypes[0].params.platform = '1cabba9e-cafe-3665-beef-f00f00f00f00';
|
|
245
|
+
bidRequestsWithMediaTypes[1].params.platform = '1cabba9e-cafe-3665-beef-f00f00f00f00';
|
|
246
|
+
|
|
247
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
248
|
+
expect(request[0].data.ext.platform).to.equal(bidRequestsWithMediaTypes[0].params.platform);
|
|
249
|
+
expect(request[1].data.ext.platform).to.equal(bidRequestsWithMediaTypes[0].params.platform);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it('should send openx adunit codes', function () {
|
|
253
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
254
|
+
expect(request[0].data.imp[0].tagid).to.equal(bidRequestsWithMediaTypes[0].params.unit);
|
|
255
|
+
expect(request[1].data.imp[0].tagid).to.equal(bidRequestsWithMediaTypes[1].params.unit);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('should send out custom params on bids that have customParams specified', function () {
|
|
259
|
+
const bidRequest = Object.assign({},
|
|
260
|
+
bidRequestsWithMediaTypes[0],
|
|
261
|
+
{
|
|
262
|
+
params: {
|
|
263
|
+
unit: '12345678',
|
|
264
|
+
delDomain: 'test-del-domain',
|
|
265
|
+
customParams: {'Test1': 'testval1+', 'test2': ['testval2/', 'testval3']}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
mockBidderRequest.bids = [bidRequest];
|
|
271
|
+
const request = spec.buildRequests([bidRequest], mockBidderRequest);
|
|
272
|
+
expect(request[0].data.imp[0].ext.customParams).to.equal(bidRequest.params.customParams);
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
describe('floors', function () {
|
|
276
|
+
it('should send out custom floors on bids that have customFloors, no currency as account currency is used', function () {
|
|
277
|
+
const bidRequest = Object.assign({},
|
|
278
|
+
bidRequestsWithMediaTypes[0],
|
|
279
|
+
{
|
|
280
|
+
params: {
|
|
281
|
+
unit: '12345678',
|
|
282
|
+
delDomain: 'test-del-domain',
|
|
283
|
+
customFloor: 1.500
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const request = spec.buildRequests([bidRequest], mockBidderRequest);
|
|
289
|
+
expect(request[0].data.imp[0].bidfloor).to.equal(bidRequest.params.customFloor);
|
|
290
|
+
expect(request[0].data.imp[0].bidfloorcur).to.equal(undefined);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
context('with floors module', function () {
|
|
294
|
+
let adServerCurrencyStub;
|
|
295
|
+
|
|
296
|
+
beforeEach(function () {
|
|
297
|
+
adServerCurrencyStub = sinon
|
|
298
|
+
.stub(config, 'getConfig')
|
|
299
|
+
.withArgs('currency.adServerCurrency')
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
afterEach(function () {
|
|
303
|
+
config.getConfig.restore();
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('should send out floors on bids in USD', function () {
|
|
307
|
+
const bidRequest = Object.assign({},
|
|
308
|
+
bidRequestsWithMediaTypes[0],
|
|
309
|
+
{
|
|
310
|
+
getFloor: () => {
|
|
311
|
+
return {
|
|
312
|
+
currency: 'USD',
|
|
313
|
+
floor: 9.99
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
const request = spec.buildRequests([bidRequest], mockBidderRequest);
|
|
320
|
+
expect(request[0].data.imp[0].bidfloor).to.equal(9.99);
|
|
321
|
+
expect(request[0].data.imp[0].bidfloorcur).to.equal('USD');
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
it('should send not send floors', function () {
|
|
325
|
+
adServerCurrencyStub.returns('EUR');
|
|
326
|
+
const bidRequest = Object.assign({},
|
|
327
|
+
bidRequestsWithMediaTypes[0],
|
|
328
|
+
{
|
|
329
|
+
getFloor: () => {
|
|
330
|
+
return {
|
|
331
|
+
currency: 'BTC',
|
|
332
|
+
floor: 9.99
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
const request = spec.buildRequests([bidRequest], mockBidderRequest);
|
|
339
|
+
expect(request[0].data.imp[0].bidfloor).to.equal(undefined)
|
|
340
|
+
expect(request[0].data.imp[0].bidfloorcur).to.equal(undefined)
|
|
341
|
+
});
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
describe('FPD', function() {
|
|
346
|
+
let bidRequests;
|
|
347
|
+
const mockBidderRequest = {refererInfo: {}};
|
|
348
|
+
|
|
349
|
+
beforeEach(function () {
|
|
350
|
+
bidRequests = [{
|
|
351
|
+
bidder: 'openx',
|
|
352
|
+
params: {
|
|
353
|
+
unit: '12345678-banner',
|
|
354
|
+
delDomain: 'test-del-domain'
|
|
355
|
+
},
|
|
356
|
+
adUnitCode: 'adunit-code',
|
|
357
|
+
mediaTypes: {
|
|
358
|
+
banner: {
|
|
359
|
+
sizes: [[300, 250], [300, 600]]
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
bidId: 'test-bid-id',
|
|
363
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
364
|
+
auctionId: 'test-auction-id',
|
|
365
|
+
transactionId: 'test-transaction-id-1'
|
|
366
|
+
}, {
|
|
367
|
+
bidder: 'openx',
|
|
368
|
+
mediaTypes: {
|
|
369
|
+
video: {
|
|
370
|
+
playerSize: [640, 480]
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
params: {
|
|
374
|
+
unit: '12345678-video',
|
|
375
|
+
delDomain: 'test-del-domain'
|
|
376
|
+
},
|
|
377
|
+
'adUnitCode': 'adunit-code',
|
|
378
|
+
|
|
379
|
+
bidId: 'test-bid-id',
|
|
380
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
381
|
+
auctionId: 'test-auction-id',
|
|
382
|
+
transactionId: 'test-transaction-id-2'
|
|
383
|
+
}];
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('ortb2.site should be merged in the request', function() {
|
|
387
|
+
const ortb2 = {
|
|
388
|
+
site: {
|
|
389
|
+
domain: 'page.example.com',
|
|
390
|
+
cat: ['IAB2'],
|
|
391
|
+
sectioncat: ['IAB2-2']
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
const request = spec.buildRequests(bidRequests, {refererInfo: {}, ortb2: ortb2});
|
|
395
|
+
let data = request[0].data;
|
|
396
|
+
expect(data.site.domain).to.equal('page.example.com');
|
|
397
|
+
expect(data.site.cat).to.deep.equal(['IAB2']);
|
|
398
|
+
expect(data.site.sectioncat).to.deep.equal(['IAB2-2']);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it('ortb2.user should be merged in the request', function() {
|
|
402
|
+
const ortb2 = {
|
|
403
|
+
user: {
|
|
404
|
+
yob: 1985
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
const request = spec.buildRequests(bidRequests, {refererInfo: {}, ortb2: ortb2});
|
|
408
|
+
let data = request[0].data;
|
|
409
|
+
expect(data.user.yob).to.equal(1985);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
describe('ortb2Imp', function() {
|
|
413
|
+
describe('ortb2Imp.ext.data.pbadslot', function() {
|
|
414
|
+
beforeEach(function () {
|
|
415
|
+
if (bidRequests[0].hasOwnProperty('ortb2Imp')) {
|
|
416
|
+
delete bidRequests[0].ortb2Imp;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
it('should not send if imp[].ext.data object is invalid', function() {
|
|
421
|
+
bidRequests[0].ortb2Imp = {
|
|
422
|
+
ext: {}
|
|
423
|
+
};
|
|
424
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
425
|
+
let data = request[0].data;
|
|
426
|
+
expect(data.imp[0].ext).to.not.have.property('data');
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it('should not send if imp[].ext.data.pbadslot is undefined', function() {
|
|
430
|
+
bidRequests[0].ortb2Imp = {
|
|
431
|
+
ext: {
|
|
432
|
+
data: {
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
437
|
+
let data = request[0].data;
|
|
438
|
+
if (data.imp[0].ext.data) {
|
|
439
|
+
expect(data.imp[0].ext.data).to.not.have.property('pbadslot');
|
|
440
|
+
} else {
|
|
441
|
+
expect(data.imp[0].ext).to.not.have.property('data');
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
it('should send if imp[].ext.data.pbadslot is string', function() {
|
|
446
|
+
bidRequests[0].ortb2Imp = {
|
|
447
|
+
ext: {
|
|
448
|
+
data: {
|
|
449
|
+
pbadslot: 'abcd'
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
454
|
+
let data = request[0].data;
|
|
455
|
+
expect(data.imp[0].ext.data).to.have.property('pbadslot');
|
|
456
|
+
expect(data.imp[0].ext.data.pbadslot).to.equal('abcd');
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
describe('ortb2Imp.ext.data.adserver', function() {
|
|
461
|
+
beforeEach(function () {
|
|
462
|
+
if (bidRequests[0].hasOwnProperty('ortb2Imp')) {
|
|
463
|
+
delete bidRequests[0].ortb2Imp;
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
it('should not send if imp[].ext.data object is invalid', function() {
|
|
468
|
+
bidRequests[0].ortb2Imp = {
|
|
469
|
+
ext: {}
|
|
470
|
+
};
|
|
471
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
472
|
+
let data = request[0].data;
|
|
473
|
+
expect(data.imp[0].ext).to.not.have.property('data');
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
it('should not send if imp[].ext.data.adserver is undefined', function() {
|
|
477
|
+
bidRequests[0].ortb2Imp = {
|
|
478
|
+
ext: {
|
|
479
|
+
data: {
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
484
|
+
let data = request[0].data;
|
|
485
|
+
if (data.imp[0].ext.data) {
|
|
486
|
+
expect(data.imp[0].ext.data).to.not.have.property('adserver');
|
|
487
|
+
} else {
|
|
488
|
+
expect(data.imp[0].ext).to.not.have.property('data');
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
it('should send', function() {
|
|
493
|
+
let adSlotValue = 'abc';
|
|
494
|
+
bidRequests[0].ortb2Imp = {
|
|
495
|
+
ext: {
|
|
496
|
+
data: {
|
|
497
|
+
adserver: {
|
|
498
|
+
name: 'GAM',
|
|
499
|
+
adslot: adSlotValue
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
505
|
+
let data = request[0].data;
|
|
506
|
+
expect(data.imp[0].ext.data.adserver.name).to.equal('GAM');
|
|
507
|
+
expect(data.imp[0].ext.data.adserver.adslot).to.equal(adSlotValue);
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
describe('ortb2Imp.ext.data.other', function() {
|
|
512
|
+
beforeEach(function () {
|
|
513
|
+
if (bidRequests[0].hasOwnProperty('ortb2Imp')) {
|
|
514
|
+
delete bidRequests[0].ortb2Imp;
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
it('should not send if imp[].ext.data object is invalid', function() {
|
|
519
|
+
bidRequests[0].ortb2Imp = {
|
|
520
|
+
ext: {}
|
|
521
|
+
};
|
|
522
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
523
|
+
let data = request[0].data;
|
|
524
|
+
expect(data.imp[0].ext).to.not.have.property('data');
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it('should not send if imp[].ext.data.other is undefined', function() {
|
|
528
|
+
bidRequests[0].ortb2Imp = {
|
|
529
|
+
ext: {
|
|
530
|
+
data: {
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
535
|
+
let data = request[0].data;
|
|
536
|
+
if (data.imp[0].ext.data) {
|
|
537
|
+
expect(data.imp[0].ext.data).to.not.have.property('other');
|
|
538
|
+
} else {
|
|
539
|
+
expect(data.imp[0].ext).to.not.have.property('data');
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
it('ortb2Imp.ext.data.other', function() {
|
|
544
|
+
bidRequests[0].ortb2Imp = {
|
|
545
|
+
ext: {
|
|
546
|
+
data: {
|
|
547
|
+
other: 1234
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
552
|
+
let data = request[0].data;
|
|
553
|
+
expect(data.imp[0].ext.data.other).to.equal(1234);
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
context('when there is a consent management framework', function () {
|
|
560
|
+
let bidRequests;
|
|
561
|
+
let mockConfig;
|
|
562
|
+
let bidderRequest;
|
|
563
|
+
|
|
564
|
+
beforeEach(function () {
|
|
565
|
+
bidRequests = [{
|
|
566
|
+
bidder: 'openx',
|
|
567
|
+
params: {
|
|
568
|
+
unit: '12345678-banner',
|
|
569
|
+
delDomain: 'test-del-domain'
|
|
570
|
+
},
|
|
571
|
+
adUnitCode: 'adunit-code',
|
|
572
|
+
mediaTypes: {
|
|
573
|
+
banner: {
|
|
574
|
+
sizes: [[300, 250], [300, 600]]
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
bidId: 'test-bid-id',
|
|
578
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
579
|
+
auctionId: 'test-auction-id',
|
|
580
|
+
transactionId: 'test-transaction-id-1'
|
|
581
|
+
}, {
|
|
582
|
+
bidder: 'openx',
|
|
583
|
+
mediaTypes: {
|
|
584
|
+
video: {
|
|
585
|
+
playerSize: [640, 480]
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
params: {
|
|
589
|
+
unit: '12345678-video',
|
|
590
|
+
delDomain: 'test-del-domain'
|
|
591
|
+
},
|
|
592
|
+
'adUnitCode': 'adunit-code',
|
|
593
|
+
|
|
594
|
+
bidId: 'test-bid-id',
|
|
595
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
596
|
+
auctionId: 'test-auction-id',
|
|
597
|
+
transactionId: 'test-transaction-id-2'
|
|
598
|
+
}];
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
afterEach(function () {
|
|
602
|
+
config.getConfig.restore();
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
describe('us_privacy', function () {
|
|
606
|
+
beforeEach(function () {
|
|
607
|
+
bidderRequest = {
|
|
608
|
+
uspConsent: '1YYN',
|
|
609
|
+
refererInfo: {}
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
sinon.stub(config, 'getConfig').callsFake((key) => {
|
|
613
|
+
return utils.deepAccess(mockConfig, key);
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
it('should send a signal to specify that US Privacy applies to this request', function () {
|
|
618
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
619
|
+
expect(request[0].data.regs.ext.us_privacy).to.equal('1YYN');
|
|
620
|
+
expect(request[1].data.regs.ext.us_privacy).to.equal('1YYN');
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
it('should not send the regs object, when consent string is undefined', function () {
|
|
624
|
+
delete bidderRequest.uspConsent;
|
|
625
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
626
|
+
expect(request[0].data.regs).to.not.have.property('ext');
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
describe('GDPR', function () {
|
|
631
|
+
beforeEach(function () {
|
|
632
|
+
bidderRequest = {
|
|
633
|
+
gdprConsent: {
|
|
634
|
+
consentString: 'test-gdpr-consent-string',
|
|
635
|
+
addtlConsent: 'test-addtl-consent-string',
|
|
636
|
+
gdprApplies: true
|
|
637
|
+
},
|
|
638
|
+
refererInfo: {}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
mockConfig = {
|
|
642
|
+
consentManagement: {
|
|
643
|
+
cmpApi: 'iab',
|
|
644
|
+
timeout: 1111,
|
|
645
|
+
allowAuctionWithoutConsent: 'cancel'
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
sinon.stub(config, 'getConfig').callsFake((key) => {
|
|
650
|
+
return utils.deepAccess(mockConfig, key);
|
|
651
|
+
});
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
it('should send a signal to specify that GDPR applies to this request', function () {
|
|
655
|
+
bidderRequest.bids = bidRequests;
|
|
656
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
657
|
+
expect(request[0].data.regs.ext.gdpr).to.equal(1);
|
|
658
|
+
expect(request[1].data.regs.ext.gdpr).to.equal(1);
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
it('should send the consent string', function () {
|
|
662
|
+
bidderRequest.bids = bidRequests;
|
|
663
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
664
|
+
expect(request[0].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString);
|
|
665
|
+
expect(request[1].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString);
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
it('should send the addtlConsent string', function () {
|
|
669
|
+
bidderRequest.bids = bidRequests;
|
|
670
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
671
|
+
expect(request[0].data.user.ext.ConsentedProvidersSettings.consented_providers).to.equal(bidderRequest.gdprConsent.addtlConsent);
|
|
672
|
+
expect(request[1].data.user.ext.ConsentedProvidersSettings.consented_providers).to.equal(bidderRequest.gdprConsent.addtlConsent);
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
it('should send a signal to specify that GDPR does not apply to this request', function () {
|
|
676
|
+
bidderRequest.gdprConsent.gdprApplies = false;
|
|
677
|
+
bidderRequest.bids = bidRequests;
|
|
678
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
679
|
+
expect(request[0].data.regs.ext.gdpr).to.equal(0);
|
|
680
|
+
expect(request[1].data.regs.ext.gdpr).to.equal(0);
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
it('when GDPR application is undefined, should not send a signal to specify whether GDPR applies to this request, ' +
|
|
684
|
+
'but can send consent data, ', function () {
|
|
685
|
+
delete bidderRequest.gdprConsent.gdprApplies;
|
|
686
|
+
bidderRequest.bids = bidRequests;
|
|
687
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
688
|
+
expect(request[0].data.regs).to.not.have.property('ext');
|
|
689
|
+
expect(request[1].data.regs).to.not.have.property('ext');
|
|
690
|
+
expect(request[0].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString);
|
|
691
|
+
expect(request[1].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString);
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
it('when consent string is undefined, should not send the consent string, ', function () {
|
|
695
|
+
delete bidderRequest.gdprConsent.consentString;
|
|
696
|
+
bidderRequest.bids = bidRequests;
|
|
697
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
698
|
+
expect(request[0].data.imp[0].ext.consent).to.equal(undefined);
|
|
699
|
+
expect(request[1].data.imp[0].ext.consent).to.equal(undefined);
|
|
700
|
+
});
|
|
701
|
+
});
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
context('coppa', function() {
|
|
705
|
+
it('when there are no coppa param settings, should not send a coppa flag', function () {
|
|
706
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
707
|
+
expect(request[0].data.regs.coppa).to.equal(0);
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
it('should send a coppa flag there is when there is coppa param settings in the bid requests', function () {
|
|
711
|
+
let mockConfig = {
|
|
712
|
+
coppa: true
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
sinon.stub(config, 'getConfig').callsFake((key) => {
|
|
716
|
+
return utils.deepAccess(mockConfig, key);
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
720
|
+
expect(request[0].data.regs.coppa).to.equal(1);
|
|
721
|
+
|
|
722
|
+
config.getConfig.restore();
|
|
723
|
+
});
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
context('do not track (DNT)', function() {
|
|
727
|
+
let doNotTrackStub;
|
|
728
|
+
|
|
729
|
+
beforeEach(function () {
|
|
730
|
+
doNotTrackStub = sinon.stub(utils, 'getDNT');
|
|
731
|
+
});
|
|
732
|
+
afterEach(function() {
|
|
733
|
+
doNotTrackStub.restore();
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
it('when there is a do not track, should send a dnt', function () {
|
|
737
|
+
doNotTrackStub.returns(1);
|
|
738
|
+
|
|
739
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
740
|
+
expect(request[0].data.device.dnt).to.equal(1);
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
it('when there is not do not track, don\'t send dnt', function () {
|
|
744
|
+
doNotTrackStub.returns(0);
|
|
745
|
+
|
|
746
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
747
|
+
expect(request[0].data.device.dnt).to.equal(0);
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it('when there is no defined do not track, don\'t send dnt', function () {
|
|
751
|
+
doNotTrackStub.returns(null);
|
|
752
|
+
|
|
753
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
754
|
+
expect(request[0].data.device.dnt).to.equal(0);
|
|
755
|
+
});
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
context('supply chain (schain)', function () {
|
|
759
|
+
let bidRequests;
|
|
760
|
+
let schainConfig;
|
|
761
|
+
const supplyChainNodePropertyOrder = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
762
|
+
|
|
763
|
+
beforeEach(function () {
|
|
764
|
+
schainConfig = {
|
|
765
|
+
ver: '1.0',
|
|
766
|
+
complete: 1,
|
|
767
|
+
nodes: [
|
|
768
|
+
{
|
|
769
|
+
asi: 'exchange1.com',
|
|
770
|
+
sid: '1234',
|
|
771
|
+
hp: 1,
|
|
772
|
+
rid: 'bid-request-1',
|
|
773
|
+
name: 'publisher',
|
|
774
|
+
domain: 'publisher.com'
|
|
775
|
+
// omitted ext
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
asi: 'exchange2.com',
|
|
779
|
+
sid: 'abcd',
|
|
780
|
+
hp: 1,
|
|
781
|
+
rid: 'bid-request-2',
|
|
782
|
+
// name field missing
|
|
783
|
+
domain: 'intermediary.com'
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
asi: 'exchange3.com',
|
|
787
|
+
sid: '4321',
|
|
788
|
+
hp: 1,
|
|
789
|
+
// request id
|
|
790
|
+
// name field missing
|
|
791
|
+
domain: 'intermediary-2.com'
|
|
792
|
+
}
|
|
793
|
+
]
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
bidRequests = [{
|
|
797
|
+
bidder: 'openx',
|
|
798
|
+
params: {
|
|
799
|
+
unit: '11',
|
|
800
|
+
delDomain: 'test-del-domain'
|
|
801
|
+
},
|
|
802
|
+
adUnitCode: '/adunit-code/test-path',
|
|
803
|
+
mediaTypes: {
|
|
804
|
+
banner: {
|
|
805
|
+
sizes: [[300, 250], [300, 600]]
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
bidId: 'test-bid-id-1',
|
|
809
|
+
bidderRequestId: 'test-bid-request-1',
|
|
810
|
+
auctionId: 'test-auction-1',
|
|
811
|
+
schain: schainConfig
|
|
812
|
+
}];
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
it('should send a supply chain object', function () {
|
|
816
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
817
|
+
expect(request[0].data.source.ext.schain).to.equal(schainConfig);
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
it('should send the supply chain object with the right version', function () {
|
|
821
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
822
|
+
expect(request[0].data.source.ext.schain.ver).to.equal(schainConfig.ver);
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
it('should send the supply chain object with the right complete value', function () {
|
|
826
|
+
const request = spec.buildRequests(bidRequests, mockBidderRequest);
|
|
827
|
+
expect(request[0].data.source.ext.schain.complete).to.equal(schainConfig.complete);
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
context('when there are userid providers', function () {
|
|
832
|
+
const userIdAsEids = [
|
|
833
|
+
{
|
|
834
|
+
source: 'adserver.org',
|
|
835
|
+
uids: [{
|
|
836
|
+
id: 'some-random-id-value',
|
|
837
|
+
atype: 1,
|
|
838
|
+
ext: {
|
|
839
|
+
rtiPartner: 'TDID'
|
|
840
|
+
}
|
|
841
|
+
}]
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
source: 'id5-sync.com',
|
|
845
|
+
uids: [{
|
|
846
|
+
id: 'some-random-id-value',
|
|
847
|
+
atype: 1
|
|
848
|
+
}]
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
source: 'sharedid.org',
|
|
852
|
+
uids: [{
|
|
853
|
+
id: 'some-random-id-value',
|
|
854
|
+
atype: 1,
|
|
855
|
+
ext: {
|
|
856
|
+
third: 'some-random-id-value'
|
|
857
|
+
}
|
|
858
|
+
}]
|
|
859
|
+
}
|
|
860
|
+
];
|
|
861
|
+
|
|
862
|
+
it(`should send the user id under the extended ids`, function () {
|
|
863
|
+
const bidRequestsWithUserId = [{
|
|
864
|
+
bidder: 'openx',
|
|
865
|
+
params: {
|
|
866
|
+
unit: '11',
|
|
867
|
+
delDomain: 'test-del-domain'
|
|
868
|
+
},
|
|
869
|
+
userId: {
|
|
870
|
+
},
|
|
871
|
+
adUnitCode: 'adunit-code',
|
|
872
|
+
mediaTypes: {
|
|
873
|
+
banner: {
|
|
874
|
+
sizes: [[300, 250], [300, 600]]
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
bidId: 'test-bid-id-1',
|
|
878
|
+
bidderRequestId: 'test-bid-request-1',
|
|
879
|
+
auctionId: 'test-auction-1',
|
|
880
|
+
userIdAsEids: userIdAsEids
|
|
881
|
+
}];
|
|
882
|
+
// enrich bid request with userId key/value
|
|
883
|
+
|
|
884
|
+
const request = spec.buildRequests(bidRequestsWithUserId, mockBidderRequest);
|
|
885
|
+
expect(request[0].data.user.ext.eids).to.equal(userIdAsEids);
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
it(`when no user ids are available, it should not send any extended ids`, function () {
|
|
889
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
890
|
+
expect(request[0].data).to.not.have.any.keys('user');
|
|
891
|
+
});
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
|
|
895
|
+
context('banner', function () {
|
|
896
|
+
it('should send bid request with a mediaTypes specified with banner type', function () {
|
|
897
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
898
|
+
expect(request[0].data.imp[0]).to.have.any.keys(BANNER);
|
|
899
|
+
});
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
context('video', function () {
|
|
903
|
+
it('should send bid request with a mediaTypes specified with video type', function () {
|
|
904
|
+
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
|
|
905
|
+
expect(request[1].data.imp[0]).to.have.any.keys(VIDEO);
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
it.skip('should send ad unit ids when any are defined', function () {
|
|
910
|
+
const bidRequestsWithUnitIds = [{
|
|
911
|
+
bidder: 'openx',
|
|
912
|
+
params: {
|
|
913
|
+
delDomain: 'test-del-domain'
|
|
914
|
+
},
|
|
915
|
+
adUnitCode: 'adunit-code',
|
|
916
|
+
mediaTypes: {
|
|
917
|
+
banner: {
|
|
918
|
+
sizes: [[300, 250], [300, 600]]
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
bidId: 'test-bid-id-1',
|
|
922
|
+
bidderRequestId: 'test-bid-request-1',
|
|
923
|
+
auctionId: 'test-auction-1',
|
|
924
|
+
transactionId: 'test-transaction-id-1'
|
|
925
|
+
}, {
|
|
926
|
+
bidder: 'openx',
|
|
927
|
+
params: {
|
|
928
|
+
unit: '22',
|
|
929
|
+
delDomain: 'test-del-domain'
|
|
930
|
+
},
|
|
931
|
+
adUnitCode: 'adunit-code',
|
|
932
|
+
mediaTypes: {
|
|
933
|
+
banner: {
|
|
934
|
+
sizes: [[728, 90]]
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
bidId: 'test-bid-id-2',
|
|
938
|
+
bidderRequestId: 'test-bid-request-2',
|
|
939
|
+
auctionId: 'test-auction-2',
|
|
940
|
+
transactionId: 'test-transaction-id-2'
|
|
941
|
+
}];
|
|
942
|
+
mockBidderRequest.bids = bidRequestsWithUnitIds;
|
|
943
|
+
const request = spec.buildRequests(bidRequestsWithUnitIds, mockBidderRequest);
|
|
944
|
+
expect(request[0].data.imp[1].tagid).to.equal(bidRequestsWithUnitIds[1].params.unit);
|
|
945
|
+
expect(request[0].data.imp[1].ext.divid).to.equal(bidRequestsWithUnitIds[1].params.adUnitCode);
|
|
946
|
+
});
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
describe('interpretResponse()', function () {
|
|
950
|
+
let bidRequestConfigs;
|
|
951
|
+
let bidRequest;
|
|
952
|
+
let bidResponse;
|
|
953
|
+
let bid;
|
|
954
|
+
|
|
955
|
+
context('when there is no response', function () {
|
|
956
|
+
let bids;
|
|
957
|
+
beforeEach(function () {
|
|
958
|
+
bidRequestConfigs = [{
|
|
959
|
+
bidder: 'openx',
|
|
960
|
+
params: {
|
|
961
|
+
unit: '12345678',
|
|
962
|
+
delDomain: 'test-del-domain'
|
|
963
|
+
},
|
|
964
|
+
adUnitCode: 'adunit-code',
|
|
965
|
+
mediaTypes: {
|
|
966
|
+
banner: {
|
|
967
|
+
sizes: [[300, 250], [300, 600]],
|
|
968
|
+
},
|
|
969
|
+
},
|
|
970
|
+
bidId: 'test-bid-id',
|
|
971
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
972
|
+
auctionId: 'test-auction-id'
|
|
973
|
+
}];
|
|
974
|
+
|
|
975
|
+
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
|
|
976
|
+
|
|
977
|
+
bidResponse = {nbr: 0}; // Unknown error
|
|
978
|
+
bids = spec.interpretResponse({body: bidResponse}, bidRequest);
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
it('should not return any bids', function () {
|
|
982
|
+
expect(bids.length).to.equal(0);
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
context('when there is a response, the common response properties', function () {
|
|
987
|
+
beforeEach(function () {
|
|
988
|
+
bidRequestConfigs = [{
|
|
989
|
+
bidder: 'openx',
|
|
990
|
+
params: {
|
|
991
|
+
unit: '12345678',
|
|
992
|
+
delDomain: 'test-del-domain'
|
|
993
|
+
},
|
|
994
|
+
adUnitCode: 'adunit-code',
|
|
995
|
+
mediaTypes: {
|
|
996
|
+
banner: {
|
|
997
|
+
sizes: [[300, 250], [300, 600]],
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
bidId: 'test-bid-id',
|
|
1001
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
1002
|
+
auctionId: 'test-auction-id'
|
|
1003
|
+
}];
|
|
1004
|
+
|
|
1005
|
+
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
|
|
1006
|
+
|
|
1007
|
+
bidResponse = {
|
|
1008
|
+
seatbid: [{
|
|
1009
|
+
bid: [{
|
|
1010
|
+
impid: 'test-bid-id',
|
|
1011
|
+
price: 2,
|
|
1012
|
+
w: 300,
|
|
1013
|
+
h: 250,
|
|
1014
|
+
crid: 'test-creative-id',
|
|
1015
|
+
dealid: 'test-deal-id',
|
|
1016
|
+
adm: 'test-ad-markup',
|
|
1017
|
+
adomain: ['brand.com'],
|
|
1018
|
+
ext: {
|
|
1019
|
+
dsp_id: '123',
|
|
1020
|
+
buyer_id: '456',
|
|
1021
|
+
brand_id: '789',
|
|
1022
|
+
paf: {
|
|
1023
|
+
content_id: 'paf_content_id'
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}]
|
|
1027
|
+
}],
|
|
1028
|
+
cur: 'AUS',
|
|
1029
|
+
ext: {
|
|
1030
|
+
paf: {
|
|
1031
|
+
transmission: {version: '12'}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
|
|
1037
|
+
});
|
|
1038
|
+
|
|
1039
|
+
it('should return a price', function () {
|
|
1040
|
+
expect(bid.cpm).to.equal(bidResponse.seatbid[0].bid[0].price);
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
it('should return a request id', function () {
|
|
1044
|
+
expect(bid.requestId).to.equal(bidResponse.seatbid[0].bid[0].impid);
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
it('should return width and height for the creative', function () {
|
|
1048
|
+
expect(bid.width).to.equal(bidResponse.seatbid[0].bid[0].w);
|
|
1049
|
+
expect(bid.height).to.equal(bidResponse.seatbid[0].bid[0].h);
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
it('should return a creativeId', function () {
|
|
1053
|
+
expect(bid.creativeId).to.equal(bidResponse.seatbid[0].bid[0].crid);
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
it('should return an ad', function () {
|
|
1057
|
+
expect(bid.ad).to.equal(bidResponse.seatbid[0].bid[0].adm);
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
it('should return a deal id if it exists', function () {
|
|
1061
|
+
expect(bid.dealId).to.equal(bidResponse.seatbid[0].bid[0].dealid);
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
it('should have a time-to-live of 5 minutes', function () {
|
|
1065
|
+
expect(bid.ttl).to.equal(300);
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
it('should always return net revenue', function () {
|
|
1069
|
+
expect(bid.netRevenue).to.equal(true);
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
it('should return a currency', function () {
|
|
1073
|
+
expect(bid.currency).to.equal(bidResponse.cur);
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
it('should return a brand ID', function () {
|
|
1077
|
+
expect(bid.meta.brandId).to.equal(bidResponse.seatbid[0].bid[0].ext.brand_id);
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
it('should return a dsp ID', function () {
|
|
1081
|
+
expect(bid.meta.networkId).to.equal(bidResponse.seatbid[0].bid[0].ext.dsp_id);
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
it('should return a buyer ID', function () {
|
|
1085
|
+
expect(bid.meta.advertiserId).to.equal(bidResponse.seatbid[0].bid[0].ext.buyer_id);
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
it('should return adomain', function () {
|
|
1089
|
+
expect(bid.meta.advertiserDomains).to.equal(bidResponse.seatbid[0].bid[0].adomain);
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
it('should return paf fields', function () {
|
|
1093
|
+
const paf = {
|
|
1094
|
+
transmission: {version: '12'},
|
|
1095
|
+
content_id: 'paf_content_id'
|
|
1096
|
+
}
|
|
1097
|
+
expect(bid.meta.paf).to.deep.equal(paf);
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
context('when the response is a banner', function() {
|
|
1102
|
+
beforeEach(function () {
|
|
1103
|
+
bidRequestConfigs = [{
|
|
1104
|
+
bidder: 'openx',
|
|
1105
|
+
params: {
|
|
1106
|
+
unit: '12345678',
|
|
1107
|
+
delDomain: 'test-del-domain'
|
|
1108
|
+
},
|
|
1109
|
+
adUnitCode: 'adunit-code',
|
|
1110
|
+
mediaTypes: {
|
|
1111
|
+
banner: {
|
|
1112
|
+
sizes: [[300, 250], [300, 600]],
|
|
1113
|
+
},
|
|
1114
|
+
},
|
|
1115
|
+
bidId: 'test-bid-id',
|
|
1116
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
1117
|
+
auctionId: 'test-auction-id'
|
|
1118
|
+
}];
|
|
1119
|
+
|
|
1120
|
+
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
|
|
1121
|
+
|
|
1122
|
+
bidResponse = {
|
|
1123
|
+
seatbid: [{
|
|
1124
|
+
bid: [{
|
|
1125
|
+
impid: 'test-bid-id',
|
|
1126
|
+
price: 2,
|
|
1127
|
+
w: 300,
|
|
1128
|
+
h: 250,
|
|
1129
|
+
crid: 'test-creative-id',
|
|
1130
|
+
dealid: 'test-deal-id',
|
|
1131
|
+
adm: 'test-ad-markup'
|
|
1132
|
+
}]
|
|
1133
|
+
}],
|
|
1134
|
+
cur: 'AUS'
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
it('should return the proper mediaType', function () {
|
|
1141
|
+
it('should return a creativeId', function () {
|
|
1142
|
+
expect(bid.mediaType).to.equal(Object.keys(bidRequestConfigs[0].mediaTypes)[0]);
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
context('when the response is a video', function() {
|
|
1148
|
+
beforeEach(function () {
|
|
1149
|
+
bidRequestConfigs = [{
|
|
1150
|
+
bidder: 'openx',
|
|
1151
|
+
params: {
|
|
1152
|
+
unit: '12345678',
|
|
1153
|
+
delDomain: 'test-del-domain'
|
|
1154
|
+
},
|
|
1155
|
+
adUnitCode: 'adunit-code',
|
|
1156
|
+
mediaTypes: {
|
|
1157
|
+
video: {
|
|
1158
|
+
playerSize: [[640, 360], [854, 480]],
|
|
1159
|
+
},
|
|
1160
|
+
},
|
|
1161
|
+
bidId: 'test-bid-id',
|
|
1162
|
+
bidderRequestId: 'test-bidder-request-id',
|
|
1163
|
+
auctionId: 'test-auction-id'
|
|
1164
|
+
}];
|
|
1165
|
+
|
|
1166
|
+
bidRequest = spec.buildRequests(bidRequestConfigs, {refererInfo: {}})[0];
|
|
1167
|
+
|
|
1168
|
+
bidResponse = {
|
|
1169
|
+
seatbid: [{
|
|
1170
|
+
bid: [{
|
|
1171
|
+
impid: 'test-bid-id',
|
|
1172
|
+
price: 2,
|
|
1173
|
+
w: 854,
|
|
1174
|
+
h: 480,
|
|
1175
|
+
crid: 'test-creative-id',
|
|
1176
|
+
dealid: 'test-deal-id',
|
|
1177
|
+
adm: 'test-ad-markup',
|
|
1178
|
+
}]
|
|
1179
|
+
}],
|
|
1180
|
+
cur: 'AUS'
|
|
1181
|
+
};
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
it('should return the proper mediaType', function () {
|
|
1185
|
+
bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
|
|
1186
|
+
expect(bid.mediaType).to.equal(Object.keys(bidRequestConfigs[0].mediaTypes)[0]);
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
it('should return the proper mediaType', function () {
|
|
1190
|
+
const winUrl = 'https//my.win.url';
|
|
1191
|
+
bidResponse.seatbid[0].bid[0].nurl = winUrl
|
|
1192
|
+
bid = spec.interpretResponse({body: bidResponse}, bidRequest)[0];
|
|
1193
|
+
|
|
1194
|
+
expect(bid.vastUrl).to.equal(winUrl);
|
|
1195
|
+
});
|
|
1196
|
+
});
|
|
1197
|
+
});
|
|
1198
|
+
|
|
1199
|
+
describe('user sync', function () {
|
|
1200
|
+
it('should register the default image pixel if no pixels available', function () {
|
|
1201
|
+
let syncs = spec.getUserSyncs(
|
|
1202
|
+
{pixelEnabled: true},
|
|
1203
|
+
[]
|
|
1204
|
+
);
|
|
1205
|
+
expect(syncs).to.deep.equal([{type: 'image', url: DEFAULT_SYNC}]);
|
|
1206
|
+
});
|
|
1207
|
+
|
|
1208
|
+
it('should register custom syncUrl when exists', function () {
|
|
1209
|
+
let syncs = spec.getUserSyncs(
|
|
1210
|
+
{pixelEnabled: true},
|
|
1211
|
+
[{body: {ext: {delDomain: 'www.url.com'}}}]
|
|
1212
|
+
);
|
|
1213
|
+
expect(syncs).to.deep.equal([{type: 'image', url: 'https://www.url.com/w/1.0/pd'}]);
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
it('should register custom syncUrl when exists', function () {
|
|
1217
|
+
let syncs = spec.getUserSyncs(
|
|
1218
|
+
{pixelEnabled: true},
|
|
1219
|
+
[{body: {ext: {platform: 'abc'}}}]
|
|
1220
|
+
);
|
|
1221
|
+
expect(syncs).to.deep.equal([{type: 'image', url: SYNC_URL + '?ph=abc'}]);
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1224
|
+
it('when iframe sync is allowed, it should register an iframe sync', function () {
|
|
1225
|
+
let syncs = spec.getUserSyncs(
|
|
1226
|
+
{iframeEnabled: true},
|
|
1227
|
+
[]
|
|
1228
|
+
);
|
|
1229
|
+
expect(syncs).to.deep.equal([{type: 'iframe', url: DEFAULT_SYNC}]);
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
it('should prioritize iframe over image for user sync', function () {
|
|
1233
|
+
let syncs = spec.getUserSyncs(
|
|
1234
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
1235
|
+
[]
|
|
1236
|
+
);
|
|
1237
|
+
expect(syncs).to.deep.equal([{type: 'iframe', url: DEFAULT_SYNC}]);
|
|
1238
|
+
});
|
|
1239
|
+
|
|
1240
|
+
describe('when gdpr applies', function () {
|
|
1241
|
+
let gdprConsent;
|
|
1242
|
+
let gdprPixelUrl;
|
|
1243
|
+
const consentString = 'gdpr-pixel-consent';
|
|
1244
|
+
const gdprApplies = '1';
|
|
1245
|
+
beforeEach(() => {
|
|
1246
|
+
gdprConsent = {
|
|
1247
|
+
consentString,
|
|
1248
|
+
gdprApplies: true
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
gdprPixelUrl = `${SYNC_URL}&gdpr=${gdprApplies}&gdpr_consent=${consentString}`;
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
it('when there is a response, it should have the gdpr query params', () => {
|
|
1255
|
+
let [{url}] = spec.getUserSyncs(
|
|
1256
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
1257
|
+
[],
|
|
1258
|
+
gdprConsent
|
|
1259
|
+
);
|
|
1260
|
+
|
|
1261
|
+
expect(url).to.have.string(`gdpr_consent=${consentString}`);
|
|
1262
|
+
expect(url).to.have.string(`gdpr=${gdprApplies}`);
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
it('should not send signals if no consent object is available', function () {
|
|
1266
|
+
let [{url}] = spec.getUserSyncs(
|
|
1267
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
1268
|
+
[],
|
|
1269
|
+
);
|
|
1270
|
+
expect(url).to.not.have.string('gdpr_consent=');
|
|
1271
|
+
expect(url).to.not.have.string('gdpr=');
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1274
|
+
|
|
1275
|
+
describe('when ccpa applies', function () {
|
|
1276
|
+
let usPrivacyConsent;
|
|
1277
|
+
let uspPixelUrl;
|
|
1278
|
+
const privacyString = 'TEST';
|
|
1279
|
+
beforeEach(() => {
|
|
1280
|
+
usPrivacyConsent = 'TEST';
|
|
1281
|
+
uspPixelUrl = `${DEFAULT_SYNC}&us_privacy=${privacyString}`
|
|
1282
|
+
});
|
|
1283
|
+
it('should send the us privacy string, ', () => {
|
|
1284
|
+
let [{url}] = spec.getUserSyncs(
|
|
1285
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
1286
|
+
[],
|
|
1287
|
+
undefined,
|
|
1288
|
+
usPrivacyConsent
|
|
1289
|
+
);
|
|
1290
|
+
expect(url).to.have.string(`us_privacy=${privacyString}`);
|
|
1291
|
+
});
|
|
1292
|
+
|
|
1293
|
+
it('should not send signals if no consent string is available', function () {
|
|
1294
|
+
let [{url}] = spec.getUserSyncs(
|
|
1295
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
1296
|
+
[],
|
|
1297
|
+
);
|
|
1298
|
+
expect(url).to.not.have.string('us_privacy=');
|
|
1299
|
+
});
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1302
|
+
})
|
|
1303
|
+
;
|