prebid.js 8.5.0 → 8.7.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/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adsinteractiveBidAdapter.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/alkimiBidAdapter.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/automatadAnalyticsAdapter.js +1 -0
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridBidAdapter.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/connatixBidAdapter.js +1 -0
- 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 +6 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freepassBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.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 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/growthCodeAnalyticsAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.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/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/medianetBidAdapter.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/mspa.js +1 -1
- package/dist/newspassidBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +140 -136
- 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/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/pubCircleBidAdapter.js +1 -0
- 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/relevadRtdProvider.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.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/ssmasBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/tappxBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/topicsFpdModule.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/viantOrtbBidAdapter.js +1 -0
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/videojsVideoProvider.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/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +1 -1
- package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +1 -1
- package/integrationExamples/videoModule/jwplayer/bidsBackHandlerOverride.html +137 -0
- package/integrationExamples/videoModule/jwplayer/eventListeners.html +1 -1
- package/integrationExamples/videoModule/jwplayer/eventsUI.html +1 -1
- package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +1 -1
- package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +1 -1
- package/integrationExamples/videoModule/jwplayer/playlist.html +1 -1
- package/integrationExamples/videoModule/videojs/bidsBackHandlerOverride.html +164 -0
- package/libraries/mspa/activityControls.js +51 -32
- package/modules/adagioBidAdapter.js +15 -1
- package/modules/adgenerationBidAdapter.js +5 -4
- package/modules/adsinteractiveBidAdapter.js +4 -2
- package/modules/alkimiBidAdapter.js +19 -7
- package/modules/appnexusBidAdapter.js +1 -1
- package/modules/automatadAnalyticsAdapter.js +325 -0
- package/modules/automatadAnalyticsAdapter.md +23 -0
- package/modules/connatixBidAdapter.js +185 -0
- package/modules/connatixBidAdapter.md +37 -0
- package/modules/criteoBidAdapter.js +18 -0
- package/modules/cwireBidAdapter.js +19 -0
- package/modules/freepassBidAdapter.js +20 -1
- package/modules/freepassBidAdapter.md +4 -1
- package/modules/gridBidAdapter.js +1 -8
- package/modules/growthCodeAnalyticsAdapter.js +7 -2
- package/modules/medianetBidAdapter.js +7 -4
- package/modules/mediasquareBidAdapter.js +3 -0
- package/modules/newspassid.md +76 -0
- package/modules/newspassidBidAdapter.js +44 -18
- package/modules/optidigitalBidAdapter.js +25 -16
- package/modules/pubCircleBidAdapter.js +231 -0
- package/modules/pubCircleBidAdapter.md +79 -0
- package/modules/relevadRtdProvider.js +6 -7
- package/modules/ssmasBidAdapter.js +2 -2
- package/modules/tappxBidAdapter.js +27 -15
- package/modules/tappxBidAdapter.md +17 -0
- package/modules/topicsFpdModule.js +21 -48
- package/modules/undertoneBidAdapter.md +1 -1
- package/modules/userId/eids.md +7 -0
- package/modules/viantOrtbBidAdapter.js +113 -0
- package/modules/viantOrtbBidAdapter.md +54 -0
- package/modules/vidazooBidAdapter.js +9 -2
- package/modules/videojsVideoProvider.js +9 -2
- package/package.json +1 -1
- package/test/spec/libraries/mspa/activityControls_spec.js +145 -212
- package/test/spec/modules/adagioBidAdapter_spec.js +89 -0
- package/test/spec/modules/adgenerationBidAdapter_spec.js +6 -6
- package/test/spec/modules/alkimiBidAdapter_spec.js +3 -9
- package/test/spec/modules/appnexusBidAdapter_spec.js +12 -1
- package/test/spec/modules/automatadAnalyticsAdapter_spec.js +533 -0
- package/test/spec/modules/connatixBidAdapter_spec.js +366 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +52 -3
- package/test/spec/modules/cwireBidAdapter_spec.js +47 -0
- package/test/spec/modules/freepassBidAdapter_spec.js +44 -0
- package/test/spec/modules/gridBidAdapter_spec.js +68 -0
- package/test/spec/modules/medianetBidAdapter_spec.js +18 -18
- package/test/spec/modules/mediasquareBidAdapter_spec.js +5 -0
- package/test/spec/modules/newspassidBidAdapter_spec.js +6 -0
- package/test/spec/modules/optidigitalBidAdapter_spec.js +9 -2
- package/test/spec/modules/pubCircleBidAdapter_spec.js +399 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +19 -0
- package/test/spec/modules/topicsFpdModule_spec.js +343 -365
- package/test/spec/modules/viantOrtbBidAdapter_spec.js +432 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import {
|
|
3
|
+
spec,
|
|
4
|
+
getBidFloor as connatixGetBidFloor
|
|
5
|
+
} from '../../../modules/connatixBidAdapter.js';
|
|
6
|
+
import { BANNER } from '../../../src/mediaTypes.js';
|
|
7
|
+
|
|
8
|
+
describe('connatixBidAdapter', function () {
|
|
9
|
+
let bid;
|
|
10
|
+
|
|
11
|
+
function mockBidRequest() {
|
|
12
|
+
const mediaTypes = {
|
|
13
|
+
banner: {
|
|
14
|
+
sizes: [16, 9],
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
bidId: 'testing',
|
|
19
|
+
bidder: 'connatix',
|
|
20
|
+
params: {
|
|
21
|
+
placementId: '30e91414-545c-4f45-a950-0bec9308ff22'
|
|
22
|
+
},
|
|
23
|
+
mediaTypes
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
describe('isBidRequestValid', function () {
|
|
28
|
+
this.beforeEach(function () {
|
|
29
|
+
bid = mockBidRequest();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('Should return true if all required fileds are present', function () {
|
|
33
|
+
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
34
|
+
});
|
|
35
|
+
it('Should return false if bidder does not correspond', function () {
|
|
36
|
+
bid.bidder = 'abc';
|
|
37
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
38
|
+
});
|
|
39
|
+
it('Should return false if bidId is missing', function () {
|
|
40
|
+
delete bid.bidId;
|
|
41
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
42
|
+
});
|
|
43
|
+
it('Should return false if params object is missing', function () {
|
|
44
|
+
delete bid.params;
|
|
45
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
46
|
+
});
|
|
47
|
+
it('Should return false if placementId is missing from params', function () {
|
|
48
|
+
delete bid.params.placementId;
|
|
49
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
50
|
+
});
|
|
51
|
+
it('Should return false if mediaTypes is missing', function () {
|
|
52
|
+
delete bid.mediaTypes;
|
|
53
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
54
|
+
});
|
|
55
|
+
it('Should return false if banner is missing from mediaTypes ', function () {
|
|
56
|
+
delete bid.mediaTypes.banner;
|
|
57
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
58
|
+
});
|
|
59
|
+
it('Should return false if sizes is missing from banner object', function () {
|
|
60
|
+
delete bid.mediaTypes.banner.sizes;
|
|
61
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
62
|
+
});
|
|
63
|
+
it('Should return false if sizes is not an array', function () {
|
|
64
|
+
bid.mediaTypes.banner.sizes = 'test';
|
|
65
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
66
|
+
});
|
|
67
|
+
it('Should return false if sizes is an empty array', function () {
|
|
68
|
+
bid.mediaTypes.banner.sizes = [];
|
|
69
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
70
|
+
});
|
|
71
|
+
it('Should return true if add an extra field was added to the bidRequest', function () {
|
|
72
|
+
bid.params.test = 1;
|
|
73
|
+
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('buildRequests', function () {
|
|
78
|
+
let serverRequest;
|
|
79
|
+
let bidderRequest = {
|
|
80
|
+
refererInfo: {
|
|
81
|
+
canonicalUrl: '',
|
|
82
|
+
numIframes: 0,
|
|
83
|
+
reachedTop: true,
|
|
84
|
+
referer: 'http://example.com',
|
|
85
|
+
stack: ['http://example.com']
|
|
86
|
+
},
|
|
87
|
+
gdprConsent: {
|
|
88
|
+
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
|
|
89
|
+
vendorData: {},
|
|
90
|
+
gdprApplies: true
|
|
91
|
+
},
|
|
92
|
+
uspConsent: '1YYY',
|
|
93
|
+
ortb2: {
|
|
94
|
+
site: {
|
|
95
|
+
data: {
|
|
96
|
+
pageType: 'article'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
this.beforeEach(function () {
|
|
103
|
+
bid = mockBidRequest();
|
|
104
|
+
serverRequest = spec.buildRequests([bid], bidderRequest);
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('Creates a ServerRequest object with method, URL and data', function () {
|
|
108
|
+
expect(serverRequest).to.exist;
|
|
109
|
+
expect(serverRequest.method).to.exist;
|
|
110
|
+
expect(serverRequest.url).to.exist;
|
|
111
|
+
expect(serverRequest.data).to.exist;
|
|
112
|
+
});
|
|
113
|
+
it('Returns POST method', function () {
|
|
114
|
+
expect(serverRequest.method).to.equal('POST');
|
|
115
|
+
});
|
|
116
|
+
it('Returns valid URL', function () {
|
|
117
|
+
expect(serverRequest.url).to.equal('https://capi.connatix.com/rtb/hba');
|
|
118
|
+
});
|
|
119
|
+
it('Returns request payload', function () {
|
|
120
|
+
expect(serverRequest.data).to.not.empty;
|
|
121
|
+
});
|
|
122
|
+
it('Validate request payload', function () {
|
|
123
|
+
expect(serverRequest.data.bidRequests[0].bidId).to.equal(bid.bidId);
|
|
124
|
+
expect(serverRequest.data.bidRequests[0].placementId).to.equal(bid.params.placementId);
|
|
125
|
+
expect(serverRequest.data.bidRequests[0].floor).to.equal(0);
|
|
126
|
+
expect(serverRequest.data.bidRequests[0].mediaTypes).to.equal(bid.mediaTypes);
|
|
127
|
+
expect(serverRequest.data.bidRequests[0].sizes).to.equal(bid.mediaTypes.sizes);
|
|
128
|
+
expect(serverRequest.data.refererInfo).to.equal(bidderRequest.refererInfo);
|
|
129
|
+
expect(serverRequest.data.gdprConsent).to.equal(bidderRequest.gdprConsent);
|
|
130
|
+
expect(serverRequest.data.uspConsent).to.equal(bidderRequest.uspConsent);
|
|
131
|
+
expect(serverRequest.data.ortb2).to.equal(bidderRequest.ortb2);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('interpretResponse', function () {
|
|
136
|
+
const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
|
|
137
|
+
const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
|
|
138
|
+
const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
|
|
139
|
+
|
|
140
|
+
let serverResponse;
|
|
141
|
+
this.beforeEach(function () {
|
|
142
|
+
serverResponse = {
|
|
143
|
+
body: {
|
|
144
|
+
CustomerId,
|
|
145
|
+
PlayerId,
|
|
146
|
+
Bids: [ Bid ]
|
|
147
|
+
},
|
|
148
|
+
headers: function() { }
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('Should return an empty array if Bids is null', function () {
|
|
153
|
+
serverResponse.body.Bids = null;
|
|
154
|
+
|
|
155
|
+
const response = spec.interpretResponse(serverResponse);
|
|
156
|
+
expect(response).to.be.an('array').that.is.empty;
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('Should return an empty array if Bids is empty array', function () {
|
|
160
|
+
serverResponse.body.Bids = [];
|
|
161
|
+
const response = spec.interpretResponse(serverResponse);
|
|
162
|
+
expect(response).to.be.an('array').that.is.empty;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('Should return an empty array if CustomerId is null', function () {
|
|
166
|
+
serverResponse.body.CustomerId = null;
|
|
167
|
+
const response = spec.interpretResponse(serverResponse);
|
|
168
|
+
expect(response).to.be.an('array').that.is.empty;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('Should return an empty array if PlayerId is null', function () {
|
|
172
|
+
serverResponse.body.PlayerId = null;
|
|
173
|
+
const response = spec.interpretResponse(serverResponse);
|
|
174
|
+
expect(response).to.be.an('array').that.is.empty;
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('Should return one bid response for one bid', function() {
|
|
178
|
+
const bidResponses = spec.interpretResponse(serverResponse);
|
|
179
|
+
expect(bidResponses.length).to.equal(1);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('Should contains the same values as in the serverResponse', function() {
|
|
183
|
+
const bidResponses = spec.interpretResponse(serverResponse);
|
|
184
|
+
|
|
185
|
+
const [ bidResponse ] = bidResponses;
|
|
186
|
+
expect(bidResponse.requestId).to.equal(serverResponse.body.Bids[0].RequestId);
|
|
187
|
+
expect(bidResponse.cpm).to.equal(serverResponse.body.Bids[0].Cpm);
|
|
188
|
+
expect(bidResponse.ttl).to.equal(serverResponse.body.Bids[0].Ttl);
|
|
189
|
+
expect(bidResponse.currency).to.equal('USD');
|
|
190
|
+
expect(bidResponse.mediaType).to.equal(BANNER);
|
|
191
|
+
expect(bidResponse.netRevenue).to.be.true;
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it('Should return n bid responses for n bids', function() {
|
|
195
|
+
serverResponse.body.Bids = [ { ...Bid }, { ...Bid } ];
|
|
196
|
+
|
|
197
|
+
const firstBidCpm = 4;
|
|
198
|
+
serverResponse.body.Bids[0].Cpm = firstBidCpm;
|
|
199
|
+
|
|
200
|
+
const secondBidCpm = 13;
|
|
201
|
+
serverResponse.body.Bids[1].Cpm = secondBidCpm;
|
|
202
|
+
|
|
203
|
+
const bidResponses = spec.interpretResponse(serverResponse);
|
|
204
|
+
expect(bidResponses.length).to.equal(2);
|
|
205
|
+
|
|
206
|
+
expect(bidResponses[0].cpm).to.equal(firstBidCpm);
|
|
207
|
+
expect(bidResponses[1].cpm).to.equal(secondBidCpm);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
describe('getUserSyncs', function() {
|
|
212
|
+
const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
|
|
213
|
+
const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
|
|
214
|
+
const UserSyncEndpoint = 'https://connatix.com/sync'
|
|
215
|
+
const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
|
|
216
|
+
|
|
217
|
+
const serverResponse = {
|
|
218
|
+
body: {
|
|
219
|
+
CustomerId,
|
|
220
|
+
PlayerId,
|
|
221
|
+
UserSyncEndpoint,
|
|
222
|
+
Bids: [ Bid ]
|
|
223
|
+
},
|
|
224
|
+
headers: function() { }
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
it('Should return an empty array when iframeEnabled: false', function () {
|
|
228
|
+
expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [], {}, {}, {})).to.be.an('array').that.is.empty;
|
|
229
|
+
});
|
|
230
|
+
it('Should return an empty array when serverResponses is emprt array', function () {
|
|
231
|
+
expect(spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [], {}, {}, {})).to.be.an('array').that.is.empty;
|
|
232
|
+
});
|
|
233
|
+
it('Should return an empty array when iframeEnabled: true but serverResponses in an empty array', function () {
|
|
234
|
+
expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [serverResponse], {}, {}, {})).to.be.an('array').that.is.empty;
|
|
235
|
+
});
|
|
236
|
+
it('Should return an empty array when iframeEnabled: true but serverResponses in an not defined or null', function () {
|
|
237
|
+
expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, undefined, {}, {}, {})).to.be.an('array').that.is.empty;
|
|
238
|
+
expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, null, {}, {}, {})).to.be.an('array').that.is.empty;
|
|
239
|
+
});
|
|
240
|
+
it('Should return one user sync object when iframeEnabled is true and serverResponses is not an empry array', function () {
|
|
241
|
+
expect(spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [serverResponse], {}, {}, {})).to.be.an('array').that.is.not.empty;
|
|
242
|
+
});
|
|
243
|
+
it('Should return a list containing a single object having type: iframe and url: syncUrl', function () {
|
|
244
|
+
const userSyncList = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [serverResponse], undefined, undefined, undefined);
|
|
245
|
+
const { type, url } = userSyncList[0];
|
|
246
|
+
expect(type).to.equal('iframe');
|
|
247
|
+
expect(url).to.equal(UserSyncEndpoint);
|
|
248
|
+
});
|
|
249
|
+
it('Should append gdpr: 0 if gdprConsent object is provided but gdprApplies field is not provided', function () {
|
|
250
|
+
const userSyncList = spec.getUserSyncs(
|
|
251
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
252
|
+
[serverResponse],
|
|
253
|
+
{},
|
|
254
|
+
undefined,
|
|
255
|
+
undefined
|
|
256
|
+
);
|
|
257
|
+
const { url } = userSyncList[0];
|
|
258
|
+
expect(url).to.equal(`${UserSyncEndpoint}?gdpr=0`);
|
|
259
|
+
});
|
|
260
|
+
it('Should append gdpr having the value of gdprApplied if gdprConsent object is present and have gdprApplies field', function () {
|
|
261
|
+
const userSyncList = spec.getUserSyncs(
|
|
262
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
263
|
+
[serverResponse],
|
|
264
|
+
{gdprApplies: true},
|
|
265
|
+
undefined,
|
|
266
|
+
undefined
|
|
267
|
+
);
|
|
268
|
+
const { url } = userSyncList[0];
|
|
269
|
+
expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1`);
|
|
270
|
+
});
|
|
271
|
+
it('Should append gdpr_consent if gdprConsent object is present and have gdprApplies field', function () {
|
|
272
|
+
const userSyncList = spec.getUserSyncs(
|
|
273
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
274
|
+
[serverResponse],
|
|
275
|
+
{gdprApplies: true, consentString: 'alabala'},
|
|
276
|
+
undefined,
|
|
277
|
+
undefined
|
|
278
|
+
);
|
|
279
|
+
const { url } = userSyncList[0];
|
|
280
|
+
expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=alabala`);
|
|
281
|
+
});
|
|
282
|
+
it('Should encodeURI gdpr_consent corectly', function () {
|
|
283
|
+
const userSyncList = spec.getUserSyncs(
|
|
284
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
285
|
+
[serverResponse],
|
|
286
|
+
{gdprApplies: true, consentString: 'test&2'},
|
|
287
|
+
undefined,
|
|
288
|
+
undefined
|
|
289
|
+
);
|
|
290
|
+
const { url } = userSyncList[0];
|
|
291
|
+
expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262`);
|
|
292
|
+
});
|
|
293
|
+
it('Should append usp_consent to the url if uspConsent is provided', function () {
|
|
294
|
+
const userSyncList = spec.getUserSyncs(
|
|
295
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
296
|
+
[serverResponse],
|
|
297
|
+
{gdprApplies: true, consentString: 'test&2'},
|
|
298
|
+
'1YYYN',
|
|
299
|
+
undefined
|
|
300
|
+
);
|
|
301
|
+
const { url } = userSyncList[0];
|
|
302
|
+
expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262&us_privacy=1YYYN`);
|
|
303
|
+
});
|
|
304
|
+
it('Should not modify the sync url if gppConsent param is provided', function () {
|
|
305
|
+
const userSyncList = spec.getUserSyncs(
|
|
306
|
+
{iframeEnabled: true, pixelEnabled: true},
|
|
307
|
+
[serverResponse],
|
|
308
|
+
{gdprApplies: true, consentString: 'test&2'},
|
|
309
|
+
'1YYYN',
|
|
310
|
+
{consent: '1'}
|
|
311
|
+
);
|
|
312
|
+
const { url } = userSyncList[0];
|
|
313
|
+
expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262&us_privacy=1YYYN`);
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
describe('getBidFloor', function () {
|
|
318
|
+
this.beforeEach(function () {
|
|
319
|
+
bid = mockBidRequest();
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it('Should return 0 if both getFloor method and bidfloor param from bid are absent.', function () {
|
|
323
|
+
const floor = connatixGetBidFloor(bid);
|
|
324
|
+
expect(floor).to.equal(0);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it('Should return the value of the bidfloor parameter if the getFloor method is not defined but the bidfloor parameter is defined', function () {
|
|
328
|
+
const floorValue = 3;
|
|
329
|
+
bid.params.bidfloor = floorValue;
|
|
330
|
+
|
|
331
|
+
const floor = connatixGetBidFloor(bid);
|
|
332
|
+
expect(floor).to.equal(floorValue);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('Should return the value of the getFloor method if the getFloor method is defined but the bidfloor parameter is not defined', function () {
|
|
336
|
+
const floorValue = 7;
|
|
337
|
+
bid.getFloor = function() {
|
|
338
|
+
return { floor: floorValue };
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const floor = connatixGetBidFloor(bid);
|
|
342
|
+
expect(floor).to.equal(floorValue);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('Should return the value of the getFloor method if both getFloor method and bidfloor parameter are defined', function () {
|
|
346
|
+
const floorParamValue = 3;
|
|
347
|
+
bid.params.bidfloor = floorParamValue;
|
|
348
|
+
|
|
349
|
+
const floorMethodValue = 7;
|
|
350
|
+
bid.getFloor = function() {
|
|
351
|
+
return { floor: floorMethodValue };
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const floor = connatixGetBidFloor(bid);
|
|
355
|
+
expect(floor).to.equal(floorMethodValue);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it('Should return 0 if the getFloor method is defined and it crash when call it', function () {
|
|
359
|
+
bid.getFloor = function() {
|
|
360
|
+
throw new Error('error');
|
|
361
|
+
};
|
|
362
|
+
const floor = connatixGetBidFloor(bid);
|
|
363
|
+
expect(floor).to.equal(0);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
} from 'modules/criteoBidAdapter.js';
|
|
10
10
|
import * as utils from 'src/utils.js';
|
|
11
11
|
import * as refererDetection from 'src/refererDetection.js';
|
|
12
|
+
import * as ajax from 'src/ajax.js';
|
|
12
13
|
import { config } from '../../../src/config.js';
|
|
13
14
|
import { BANNER, NATIVE, VIDEO } from '../../../src/mediaTypes.js';
|
|
14
15
|
|
|
15
16
|
describe('The Criteo bidding adapter', function () {
|
|
16
|
-
let utilsMock, sandbox;
|
|
17
|
+
let utilsMock, sandbox, ajaxStub;
|
|
17
18
|
|
|
18
19
|
beforeEach(function () {
|
|
19
20
|
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
@@ -26,6 +27,7 @@ describe('The Criteo bidding adapter', function () {
|
|
|
26
27
|
utilsMock = sinon.mock(utils);
|
|
27
28
|
|
|
28
29
|
sandbox = sinon.sandbox.create();
|
|
30
|
+
ajaxStub = sandbox.stub(ajax, 'ajax');
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
afterEach(function () {
|
|
@@ -33,6 +35,7 @@ describe('The Criteo bidding adapter', function () {
|
|
|
33
35
|
global.Criteo = undefined;
|
|
34
36
|
utilsMock.restore();
|
|
35
37
|
sandbox.restore();
|
|
38
|
+
ajaxStub.restore();
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
describe('getUserSyncs', function () {
|
|
@@ -56,7 +59,9 @@ describe('The Criteo bidding adapter', function () {
|
|
|
56
59
|
cookiesAreEnabledStub,
|
|
57
60
|
localStorageIsEnabledStub,
|
|
58
61
|
getCookieStub,
|
|
59
|
-
|
|
62
|
+
setCookieStub,
|
|
63
|
+
getDataFromLocalStorageStub,
|
|
64
|
+
removeDataFromLocalStorageStub;
|
|
60
65
|
|
|
61
66
|
beforeEach(function () {
|
|
62
67
|
getConfigStub = sinon.stub(config, 'getConfig');
|
|
@@ -75,8 +80,10 @@ describe('The Criteo bidding adapter', function () {
|
|
|
75
80
|
localStorageIsEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
76
81
|
localStorageIsEnabledStub.returns(true);
|
|
77
82
|
|
|
78
|
-
getCookieStub = sinon.stub(storage, 'getCookie')
|
|
83
|
+
getCookieStub = sinon.stub(storage, 'getCookie');
|
|
84
|
+
setCookieStub = sinon.stub(storage, 'setCookie');
|
|
79
85
|
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
|
|
86
|
+
removeDataFromLocalStorageStub = sinon.stub(storage, 'removeDataFromLocalStorage');
|
|
80
87
|
});
|
|
81
88
|
|
|
82
89
|
afterEach(function () {
|
|
@@ -86,7 +93,9 @@ describe('The Criteo bidding adapter', function () {
|
|
|
86
93
|
cookiesAreEnabledStub.restore();
|
|
87
94
|
localStorageIsEnabledStub.restore();
|
|
88
95
|
getCookieStub.restore();
|
|
96
|
+
setCookieStub.restore();
|
|
89
97
|
getDataFromLocalStorageStub.restore();
|
|
98
|
+
removeDataFromLocalStorageStub.restore();
|
|
90
99
|
});
|
|
91
100
|
|
|
92
101
|
it('should not trigger sync if publisher is using fast bid', function () {
|
|
@@ -198,6 +207,46 @@ describe('The Criteo bidding adapter', function () {
|
|
|
198
207
|
url: `https://gum.criteo.com/syncframe?origin=criteoPrebidAdapter&topUrl=www.abc.com&us_privacy=ABC#${JSON.stringify(expectedHash).replace(/"/g, '%22')}`
|
|
199
208
|
}]);
|
|
200
209
|
});
|
|
210
|
+
|
|
211
|
+
it('should delete user data when calling onDataDeletionRequest', () => {
|
|
212
|
+
const cookieData = {
|
|
213
|
+
'cto_bundle': 'a'
|
|
214
|
+
};
|
|
215
|
+
const lsData = {
|
|
216
|
+
'cto_bundle': 'a'
|
|
217
|
+
}
|
|
218
|
+
getCookieStub.callsFake(cookieName => cookieData[cookieName]);
|
|
219
|
+
setCookieStub.callsFake((cookieName, value, expires) => cookieData[cookieName] = value);
|
|
220
|
+
getDataFromLocalStorageStub.callsFake(name => lsData[name]);
|
|
221
|
+
removeDataFromLocalStorageStub.callsFake(name => lsData[name] = '');
|
|
222
|
+
spec.onDataDeletionRequest([]);
|
|
223
|
+
expect(getCookieStub.calledOnce).to.equal(true);
|
|
224
|
+
expect(setCookieStub.calledOnce).to.equal(true);
|
|
225
|
+
expect(getDataFromLocalStorageStub.calledOnce).to.equal(true);
|
|
226
|
+
expect(removeDataFromLocalStorageStub.calledOnce).to.equal(true);
|
|
227
|
+
expect(cookieData.cto_bundle).to.equal('');
|
|
228
|
+
expect(lsData.cto_bundle).to.equal('');
|
|
229
|
+
expect(ajaxStub.calledOnce).to.equal(true);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('should not call API when calling onDataDeletionRequest with no id', () => {
|
|
233
|
+
const cookieData = {
|
|
234
|
+
'cto_bundle': ''
|
|
235
|
+
};
|
|
236
|
+
const lsData = {
|
|
237
|
+
'cto_bundle': ''
|
|
238
|
+
}
|
|
239
|
+
getCookieStub.callsFake(cookieName => cookieData[cookieName]);
|
|
240
|
+
setCookieStub.callsFake((cookieName, value, expires) => cookieData[cookieName] = value);
|
|
241
|
+
getDataFromLocalStorageStub.callsFake(name => lsData[name]);
|
|
242
|
+
removeDataFromLocalStorageStub.callsFake(name => lsData[name] = '');
|
|
243
|
+
spec.onDataDeletionRequest([]);
|
|
244
|
+
expect(getCookieStub.calledOnce).to.be.true;
|
|
245
|
+
expect(setCookieStub.called).to.be.false;
|
|
246
|
+
expect(getDataFromLocalStorageStub.calledOnce).to.be.true
|
|
247
|
+
expect(removeDataFromLocalStorageStub.called).to.be.false;
|
|
248
|
+
expect(ajaxStub.called).to.be.false;
|
|
249
|
+
});
|
|
201
250
|
});
|
|
202
251
|
|
|
203
252
|
describe('isBidRequestValid', function () {
|
|
@@ -293,4 +293,51 @@ describe('C-WIRE bid adapter', () => {
|
|
|
293
293
|
expect(bids[0].ad).to.exist;
|
|
294
294
|
})
|
|
295
295
|
});
|
|
296
|
+
|
|
297
|
+
describe('add user-syncs', function () {
|
|
298
|
+
it('empty user-syncs if no consent given', function () {
|
|
299
|
+
const userSyncs = spec.getUserSyncs({}, {}, {}, {});
|
|
300
|
+
|
|
301
|
+
expect(userSyncs).to.be.empty
|
|
302
|
+
})
|
|
303
|
+
it('empty user-syncs if no syncOption enabled', function () {
|
|
304
|
+
let gdprConsent = {
|
|
305
|
+
vendorData: {
|
|
306
|
+
purpose: {
|
|
307
|
+
consents: 1
|
|
308
|
+
}
|
|
309
|
+
}};
|
|
310
|
+
const userSyncs = spec.getUserSyncs({}, {}, gdprConsent, {});
|
|
311
|
+
|
|
312
|
+
expect(userSyncs).to.be.empty
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
it('user-syncs with enabled pixel option', function () {
|
|
316
|
+
let gdprConsent = {
|
|
317
|
+
vendorData: {
|
|
318
|
+
purpose: {
|
|
319
|
+
consents: 1
|
|
320
|
+
}
|
|
321
|
+
}};
|
|
322
|
+
let synOptions = {pixelEnabled: true, iframeEnabled: true};
|
|
323
|
+
const userSyncs = spec.getUserSyncs(synOptions, {}, gdprConsent, {});
|
|
324
|
+
|
|
325
|
+
expect(userSyncs[0].type).to.equal('image');
|
|
326
|
+
expect(userSyncs[0].url).to.equal('https://ib.adnxs.com/getuid?https://prebid.cwi.re/v1/cookiesync?xandrId=$UID');
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
it('user-syncs with enabled iframe option', function () {
|
|
330
|
+
let gdprConsent = {
|
|
331
|
+
vendorData: {
|
|
332
|
+
purpose: {
|
|
333
|
+
consents: 1
|
|
334
|
+
}
|
|
335
|
+
}};
|
|
336
|
+
let synOptions = {iframeEnabled: true};
|
|
337
|
+
const userSyncs = spec.getUserSyncs(synOptions, {}, gdprConsent, {});
|
|
338
|
+
|
|
339
|
+
expect(userSyncs[0].type).to.equal('iframe');
|
|
340
|
+
expect(userSyncs[0].url).to.equal('https://ib.adnxs.com/getuid?https://prebid.cwi.re/v1/cookiesync?xandrId=$UID');
|
|
341
|
+
})
|
|
342
|
+
})
|
|
296
343
|
});
|
|
@@ -19,6 +19,9 @@ describe('FreePass adapter', function () {
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
adUnitCode: 'adunit-code',
|
|
22
|
+
params: {
|
|
23
|
+
publisherId: 'publisherIdValue'
|
|
24
|
+
}
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
it('should return true when required params found', function () {
|
|
@@ -30,6 +33,12 @@ describe('FreePass adapter', function () {
|
|
|
30
33
|
delete localBid.adUnitCode;
|
|
31
34
|
expect(spec.isBidRequestValid(localBid)).to.equal(false);
|
|
32
35
|
});
|
|
36
|
+
|
|
37
|
+
it('should return false when params.publisherId is missing', function () {
|
|
38
|
+
let localBid = Object.assign({}, bid);
|
|
39
|
+
delete localBid.params.publisherId;
|
|
40
|
+
expect(spec.isBidRequestValid(localBid)).to.equal(false);
|
|
41
|
+
});
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
describe('buildRequests', function () {
|
|
@@ -43,6 +52,10 @@ describe('FreePass adapter', function () {
|
|
|
43
52
|
'userId': '56c4c789-71ce-46f5-989e-9e543f3d5f96',
|
|
44
53
|
'commonId': 'commonIdValue'
|
|
45
54
|
}
|
|
55
|
+
},
|
|
56
|
+
'adUnitCode': 'adunit-code',
|
|
57
|
+
'params': {
|
|
58
|
+
'publisherId': 'publisherIdValue'
|
|
46
59
|
}
|
|
47
60
|
}];
|
|
48
61
|
bidderRequest = {};
|
|
@@ -108,6 +121,33 @@ describe('FreePass adapter', function () {
|
|
|
108
121
|
expect(ortbData.device.ext).to.be.an('object');
|
|
109
122
|
expect(ortbData.device.ext.is_accurate_ip).to.equal(0);
|
|
110
123
|
});
|
|
124
|
+
|
|
125
|
+
it('it should add publisher related information w/o publisherUrl', function () {
|
|
126
|
+
const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
127
|
+
const ortbData = bidRequest.data;
|
|
128
|
+
expect(ortbData.site).to.be.an('object');
|
|
129
|
+
expect(ortbData.site.publisher.id).to.equal('publisherIdValue');
|
|
130
|
+
// publisher.domain is optional
|
|
131
|
+
expect(ortbData.site.publisher.domain).to.be.undefined;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('it should add publisher related information w/ publisherUrl', function () {
|
|
135
|
+
const PUBLISHER_URL = 'publisherUrlValue';
|
|
136
|
+
let localBidRequests = [Object.assign({}, bidRequests[0])];
|
|
137
|
+
localBidRequests[0].params.publisherUrl = PUBLISHER_URL;
|
|
138
|
+
const bidRequest = spec.buildRequests(localBidRequests, bidderRequest);
|
|
139
|
+
const ortbData = bidRequest.data;
|
|
140
|
+
expect(ortbData.site).to.be.an('object');
|
|
141
|
+
expect(ortbData.site.publisher.id).to.equal('publisherIdValue');
|
|
142
|
+
// publisher.domain is optional. set when given
|
|
143
|
+
expect(ortbData.site.publisher.domain).to.equal(PUBLISHER_URL);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('it should imp.tagId from adUnitCode', function () {
|
|
147
|
+
const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
148
|
+
const ortbData = bidRequest.data;
|
|
149
|
+
expect(ortbData.imp[0].tagId).to.equal('adunit-code');
|
|
150
|
+
});
|
|
111
151
|
});
|
|
112
152
|
|
|
113
153
|
describe('interpretResponse', function () {
|
|
@@ -122,6 +162,10 @@ describe('FreePass adapter', function () {
|
|
|
122
162
|
'userId': '56c4c789-71ce-46f5-989e-9e543f3d5f96',
|
|
123
163
|
'commonId': 'commonIdValue'
|
|
124
164
|
}
|
|
165
|
+
},
|
|
166
|
+
'adUnitCode': 'adunit-code',
|
|
167
|
+
'params': {
|
|
168
|
+
'publisherId': 'publisherIdValue'
|
|
125
169
|
}
|
|
126
170
|
}];
|
|
127
171
|
bidderRequest = {};
|
|
@@ -786,6 +786,74 @@ describe('TheMediaGrid Adapter', function () {
|
|
|
786
786
|
});
|
|
787
787
|
});
|
|
788
788
|
|
|
789
|
+
it('should prioritize pbadslot over adslot', function() {
|
|
790
|
+
const ortb2Imp = [{
|
|
791
|
+
ext: {
|
|
792
|
+
data: {
|
|
793
|
+
adserver: {
|
|
794
|
+
adslot: 'adslot'
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}, {
|
|
799
|
+
ext: {
|
|
800
|
+
data: {
|
|
801
|
+
adserver: {
|
|
802
|
+
adslot: 'adslot'
|
|
803
|
+
},
|
|
804
|
+
pbadslot: 'pbadslot'
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}];
|
|
808
|
+
const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 2).map((bid, ind) => {
|
|
809
|
+
return Object.assign({}, bid, ortb2Imp[ind] ? { ortb2Imp: {...bid.ortb2Imp, ...ortb2Imp[ind]} } : {});
|
|
810
|
+
});
|
|
811
|
+
const [request] = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
|
|
812
|
+
expect(request.data).to.be.an('string');
|
|
813
|
+
const payload = parseRequest(request.data);
|
|
814
|
+
expect(payload.imp[0].ext.gpid).to.equal(ortb2Imp[0].ext.data.adserver.adslot);
|
|
815
|
+
expect(payload.imp[1].ext.gpid).to.equal(ortb2Imp[1].ext.data.pbadslot);
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
it('should prioritize gpid over pbadslot and adslot', function() {
|
|
819
|
+
const ortb2Imp = [{
|
|
820
|
+
ext: {
|
|
821
|
+
gpid: 'gpid',
|
|
822
|
+
data: {
|
|
823
|
+
adserver: {
|
|
824
|
+
adslot: 'adslot'
|
|
825
|
+
},
|
|
826
|
+
pbadslot: 'pbadslot'
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}, {
|
|
830
|
+
ext: {
|
|
831
|
+
gpid: 'gpid',
|
|
832
|
+
data: {
|
|
833
|
+
adserver: {
|
|
834
|
+
adslot: 'adslot'
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}, {
|
|
839
|
+
ext: {
|
|
840
|
+
gpid: 'gpid',
|
|
841
|
+
data: {
|
|
842
|
+
pbadslot: 'pbadslot'
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}];
|
|
846
|
+
const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 3).map((bid, ind) => {
|
|
847
|
+
return Object.assign({}, bid, ortb2Imp[ind] ? { ortb2Imp: {...bid.ortb2Imp, ...ortb2Imp[ind]} } : {});
|
|
848
|
+
});
|
|
849
|
+
const [request] = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
|
|
850
|
+
expect(request.data).to.be.an('string');
|
|
851
|
+
const payload = parseRequest(request.data);
|
|
852
|
+
expect(payload.imp[0].ext.gpid).to.equal(ortb2Imp[0].ext.gpid);
|
|
853
|
+
expect(payload.imp[1].ext.gpid).to.equal(ortb2Imp[1].ext.gpid);
|
|
854
|
+
expect(payload.imp[2].ext.gpid).to.equal(ortb2Imp[2].ext.gpid);
|
|
855
|
+
});
|
|
856
|
+
|
|
789
857
|
it('should contain imp[].instl if available', function() {
|
|
790
858
|
const ortb2Imp = [{
|
|
791
859
|
instl: 1
|