prebid.js 6.7.0 → 6.8.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/integrationExamples/gpt/x-domain/creative.html +53 -26
- package/modules/adagioBidAdapter.js +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/appnexusBidAdapter.js +11 -0
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/criteoBidAdapter.js +9 -0
- package/modules/currency.js +26 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/gumgumBidAdapter.js +52 -38
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/yahoosspBidAdapter.js +2 -0
- package/package.json +1 -1
- package/src/adRendering.js +38 -0
- package/src/auction.js +44 -9
- package/src/prebid.js +3 -19
- package/src/secureCreatives.js +111 -42
- package/src/utils.js +13 -3
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +148 -16
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/currency_spec.js +21 -6
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/unit/pbjs_api_spec.js +17 -1
- package/test/spec/unit/secureCreatives_spec.js +85 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { expect } from 'chai'
|
|
2
|
+
import {spec} from 'modules/displayioBidAdapter.js'
|
|
3
|
+
|
|
4
|
+
describe('Displayio adapter', function () {
|
|
5
|
+
const BIDDER = 'displayio'
|
|
6
|
+
const bidRequests = [{
|
|
7
|
+
bidId: 'bidId_001',
|
|
8
|
+
bidder: BIDDER,
|
|
9
|
+
adUnitCode: 'adUnit_001',
|
|
10
|
+
auctionId: 'auctionId_001',
|
|
11
|
+
bidderRequestId: 'bidderRequestId_001',
|
|
12
|
+
mediaTypes: {
|
|
13
|
+
banner: {
|
|
14
|
+
sizes: [[320, 480]]
|
|
15
|
+
},
|
|
16
|
+
video: {
|
|
17
|
+
sizes: [[360, 640]]
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
params: {
|
|
21
|
+
siteId: 1,
|
|
22
|
+
placementId: 1,
|
|
23
|
+
adsSrvDomain: 'adsSrvDomain',
|
|
24
|
+
cdnDomain: 'cdnDomain',
|
|
25
|
+
}
|
|
26
|
+
}]
|
|
27
|
+
const bidderRequest = {
|
|
28
|
+
refererInfo: {
|
|
29
|
+
referer: 'testprebid.com'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('isBidRequestValid', function () {
|
|
34
|
+
it('should return true when required params found', function() {
|
|
35
|
+
const validBid = spec.isBidRequestValid(bidRequests[0])
|
|
36
|
+
expect(validBid).to.be.true
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const bidRequestsNoParams = [{
|
|
40
|
+
bidder: BIDDER,
|
|
41
|
+
}]
|
|
42
|
+
it('should not validate without params', function () {
|
|
43
|
+
const request = spec.isBidRequestValid(bidRequestsNoParams, bidderRequest)
|
|
44
|
+
expect(request).to.be.false
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const noSiteId = {
|
|
48
|
+
bidder: BIDDER,
|
|
49
|
+
params: {
|
|
50
|
+
placementId: 1,
|
|
51
|
+
adsSrvDomain: 'adsSrvDomain',
|
|
52
|
+
cdnDomain: 'cdnDomain',
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
it('should not validate without siteId', function() {
|
|
56
|
+
const invalidBid = spec.isBidRequestValid(noSiteId)
|
|
57
|
+
expect(invalidBid).to.be.false
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const noPlacementId = {
|
|
61
|
+
bidder: BIDDER,
|
|
62
|
+
params: {
|
|
63
|
+
siteId: 1,
|
|
64
|
+
adsSrvDomain: 'adsSrvDomain',
|
|
65
|
+
cdnDomain: 'cdnDomain',
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
it('should not validate without placementId', function() {
|
|
69
|
+
const invalidBid = spec.isBidRequestValid(noPlacementId)
|
|
70
|
+
expect(invalidBid).to.be.false
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const noAdsSrvDomain = {
|
|
74
|
+
bidder: BIDDER,
|
|
75
|
+
params: {
|
|
76
|
+
siteId: 1,
|
|
77
|
+
placementId: 1,
|
|
78
|
+
cdnDomain: 'cdnDomain',
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
it('should not validate without adsSrvDomain', function() {
|
|
82
|
+
const invalidBid = spec.isBidRequestValid(noAdsSrvDomain)
|
|
83
|
+
expect(invalidBid).to.be.false
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const noCdnDomain = {
|
|
87
|
+
bidder: BIDDER,
|
|
88
|
+
params: {
|
|
89
|
+
siteId: 1,
|
|
90
|
+
placementId: 1,
|
|
91
|
+
adsSrvDomain: 'adsSrvDomain',
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
it('should not validate without cdnDomain', function() {
|
|
95
|
+
const invalidBid = spec.isBidRequestValid(noCdnDomain)
|
|
96
|
+
expect(invalidBid).to.be.false
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
describe('buildRequests', function () {
|
|
101
|
+
it('should build request', function() {
|
|
102
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
103
|
+
expect(request).to.not.be.empty
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('sends bid request to the endpoint via POST', function () {
|
|
107
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
108
|
+
expect(request[0].method).to.equal('POST')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('sends all bid parameters', function () {
|
|
112
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
113
|
+
expect(request[0]).to.have.keys(['headers', 'data', 'method', 'url'])
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('should not crash when there is no media types', function () {
|
|
117
|
+
const bidRequestsNoMediaTypes = [{
|
|
118
|
+
bidder: BIDDER,
|
|
119
|
+
params: {
|
|
120
|
+
siteId: 1,
|
|
121
|
+
placementId: 1,
|
|
122
|
+
adsSrvDomain: 'adsSrvDomain',
|
|
123
|
+
cdnDomain: 'cdnDomain',
|
|
124
|
+
}
|
|
125
|
+
}]
|
|
126
|
+
const request = spec.buildRequests(bidRequestsNoMediaTypes, bidderRequest)
|
|
127
|
+
expect(request[0]).to.have.keys(['headers', 'data', 'method', 'url'])
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
describe('_getPayload', function () {
|
|
132
|
+
const payload = spec._getPayload(bidRequests[0], bidderRequest)
|
|
133
|
+
it('should not be empty', function() {
|
|
134
|
+
expect(payload).to.not.be.empty
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
it('should have userSession', function() {
|
|
138
|
+
expect(payload.userSession).to.be.a('string')
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it('should have data object', function() {
|
|
142
|
+
expect(payload.data).to.be.a('object')
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('should have complianceData object', function() {
|
|
146
|
+
expect(payload.data.complianceData).to.be.a('object')
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('should have device object', function() {
|
|
150
|
+
expect(payload.data.device).to.be.a('object')
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
it('should have omidpn', function() {
|
|
154
|
+
expect(payload.data.omidpn).to.be.a('string')
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it('should have integration', function() {
|
|
158
|
+
expect(payload.data.integration).to.be.a('string')
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it('should have bidId', function() {
|
|
162
|
+
expect(payload.data.id).to.not.be.empty
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
it('should have action getPlacement', function() {
|
|
166
|
+
expect(payload.data.action).to.be.equal('getPlacement')
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
it('should have app parameter', function() {
|
|
170
|
+
expect(payload.data.app).to.be.a('number')
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
it('should have placement parameter', function() {
|
|
174
|
+
expect(payload.data.placement).to.be.a('number')
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
describe('interpretResponse', function () {
|
|
179
|
+
const response = {
|
|
180
|
+
body: {
|
|
181
|
+
status: 'ok',
|
|
182
|
+
data: {
|
|
183
|
+
ads: [{
|
|
184
|
+
ad: {
|
|
185
|
+
data: {
|
|
186
|
+
id: '001',
|
|
187
|
+
ecpm: 100,
|
|
188
|
+
w: 32,
|
|
189
|
+
h: 480,
|
|
190
|
+
markup: 'test ad'
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
subtype: 'html'
|
|
194
|
+
}],
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const serverRequest = {
|
|
199
|
+
data: {
|
|
200
|
+
data: {
|
|
201
|
+
id: 'id_001',
|
|
202
|
+
data: {
|
|
203
|
+
ref: 'testprebid.com'
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let ir = spec.interpretResponse(response, serverRequest)
|
|
210
|
+
|
|
211
|
+
expect(ir.length).to.equal(1)
|
|
212
|
+
|
|
213
|
+
ir = ir[0]
|
|
214
|
+
|
|
215
|
+
it('should have requestId', function() {
|
|
216
|
+
expect(ir.requestId).to.be.a('string')
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
it('should have cpm', function() {
|
|
220
|
+
expect(ir.cpm).to.be.a('number')
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
it('should have width', function() {
|
|
224
|
+
expect(ir.width).to.be.a('number')
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it('should have height', function() {
|
|
228
|
+
expect(ir.height).to.be.a('number')
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
it('should have creativeId', function() {
|
|
232
|
+
expect(ir.creativeId).to.be.a('number')
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
it('should have ad', function() {
|
|
236
|
+
expect(ir.ad).to.be.a('string')
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
})
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {spec} from '../../../modules/e_volutionBidAdapter.js';
|
|
3
|
+
|
|
4
|
+
describe('EvolutionTechBidAdapter', function () {
|
|
5
|
+
let bid = {
|
|
6
|
+
bidId: '23fhj33i987f',
|
|
7
|
+
bidder: 'e_volution',
|
|
8
|
+
params: {
|
|
9
|
+
placementId: 0
|
|
10
|
+
},
|
|
11
|
+
mediaTypes: {
|
|
12
|
+
banner: {
|
|
13
|
+
sizes: [[300, 250]],
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('isBidRequestValid', function () {
|
|
19
|
+
it('Should return true if there are bidId, params and placementId parameters present', function () {
|
|
20
|
+
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
21
|
+
});
|
|
22
|
+
it('Should return false if at least one of parameters is not present', function () {
|
|
23
|
+
delete bid.params.placementId;
|
|
24
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('buildRequests', function () {
|
|
29
|
+
let serverRequest = spec.buildRequests([bid]);
|
|
30
|
+
it('Creates a ServerRequest object with method, URL and data', function () {
|
|
31
|
+
expect(serverRequest).to.exist;
|
|
32
|
+
expect(serverRequest.method).to.exist;
|
|
33
|
+
expect(serverRequest.url).to.exist;
|
|
34
|
+
expect(serverRequest.data).to.exist;
|
|
35
|
+
});
|
|
36
|
+
it('Returns POST method', function () {
|
|
37
|
+
expect(serverRequest.method).to.equal('POST');
|
|
38
|
+
});
|
|
39
|
+
it('Returns valid URL', function () {
|
|
40
|
+
expect(serverRequest.url).to.equal('https://service.e-volution.ai/?c=o&m=multi');
|
|
41
|
+
});
|
|
42
|
+
it('Returns valid data if array of bids is valid', function () {
|
|
43
|
+
let data = serverRequest.data;
|
|
44
|
+
expect(data).to.be.an('object');
|
|
45
|
+
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements');
|
|
46
|
+
expect(data.deviceWidth).to.be.a('number');
|
|
47
|
+
expect(data.deviceHeight).to.be.a('number');
|
|
48
|
+
expect(data.language).to.be.a('string');
|
|
49
|
+
expect(data.secure).to.be.within(0, 1);
|
|
50
|
+
expect(data.host).to.be.a('string');
|
|
51
|
+
expect(data.page).to.be.a('string');
|
|
52
|
+
let placement = data['placements'][0];
|
|
53
|
+
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'sizes', 'bidfloor');
|
|
54
|
+
expect(placement.placementId).to.equal(0);
|
|
55
|
+
expect(placement.bidId).to.equal('23fhj33i987f');
|
|
56
|
+
expect(placement.traffic).to.equal('banner');
|
|
57
|
+
});
|
|
58
|
+
it('Returns empty data if no valid requests are passed', function () {
|
|
59
|
+
serverRequest = spec.buildRequests([]);
|
|
60
|
+
let data = serverRequest.data;
|
|
61
|
+
expect(data.placements).to.be.an('array').that.is.empty;
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('interpretResponse', function () {
|
|
65
|
+
it('Should interpret banner response', function () {
|
|
66
|
+
const banner = {
|
|
67
|
+
body: [{
|
|
68
|
+
mediaType: 'banner',
|
|
69
|
+
width: 300,
|
|
70
|
+
height: 250,
|
|
71
|
+
cpm: 0.4,
|
|
72
|
+
ad: 'Test',
|
|
73
|
+
requestId: '23fhj33i987f',
|
|
74
|
+
ttl: 120,
|
|
75
|
+
creativeId: '2',
|
|
76
|
+
netRevenue: true,
|
|
77
|
+
currency: 'USD',
|
|
78
|
+
dealId: '1',
|
|
79
|
+
meta: {}
|
|
80
|
+
}]
|
|
81
|
+
};
|
|
82
|
+
let bannerResponses = spec.interpretResponse(banner);
|
|
83
|
+
expect(bannerResponses).to.be.an('array').that.is.not.empty;
|
|
84
|
+
let dataItem = bannerResponses[0];
|
|
85
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
|
|
86
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
87
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
88
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
89
|
+
expect(dataItem.width).to.equal(300);
|
|
90
|
+
expect(dataItem.height).to.equal(250);
|
|
91
|
+
expect(dataItem.ad).to.equal('Test');
|
|
92
|
+
expect(dataItem.ttl).to.equal(120);
|
|
93
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
94
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
95
|
+
expect(dataItem.currency).to.equal('USD');
|
|
96
|
+
});
|
|
97
|
+
it('Should interpret video response', function () {
|
|
98
|
+
const video = {
|
|
99
|
+
body: [{
|
|
100
|
+
vastUrl: 'test.com',
|
|
101
|
+
mediaType: 'video',
|
|
102
|
+
cpm: 0.5,
|
|
103
|
+
requestId: '23fhj33i987f',
|
|
104
|
+
ttl: 120,
|
|
105
|
+
creativeId: '2',
|
|
106
|
+
netRevenue: true,
|
|
107
|
+
currency: 'USD',
|
|
108
|
+
dealId: '1',
|
|
109
|
+
meta: {}
|
|
110
|
+
}]
|
|
111
|
+
};
|
|
112
|
+
let videoResponses = spec.interpretResponse(video);
|
|
113
|
+
expect(videoResponses).to.be.an('array').that.is.not.empty;
|
|
114
|
+
|
|
115
|
+
let dataItem = videoResponses[0];
|
|
116
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
|
|
117
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
118
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
119
|
+
expect(dataItem.cpm).to.equal(0.5);
|
|
120
|
+
expect(dataItem.vastUrl).to.equal('test.com');
|
|
121
|
+
expect(dataItem.ttl).to.equal(120);
|
|
122
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
123
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
124
|
+
expect(dataItem.currency).to.equal('USD');
|
|
125
|
+
});
|
|
126
|
+
it('Should interpret native response', function () {
|
|
127
|
+
const native = {
|
|
128
|
+
body: [{
|
|
129
|
+
mediaType: 'native',
|
|
130
|
+
native: {
|
|
131
|
+
clickUrl: 'test.com',
|
|
132
|
+
title: 'Test',
|
|
133
|
+
image: 'test.com',
|
|
134
|
+
impressionTrackers: ['test.com'],
|
|
135
|
+
},
|
|
136
|
+
ttl: 120,
|
|
137
|
+
cpm: 0.4,
|
|
138
|
+
requestId: '23fhj33i987f',
|
|
139
|
+
creativeId: '2',
|
|
140
|
+
netRevenue: true,
|
|
141
|
+
currency: 'USD',
|
|
142
|
+
meta: {}
|
|
143
|
+
}]
|
|
144
|
+
};
|
|
145
|
+
let nativeResponses = spec.interpretResponse(native);
|
|
146
|
+
expect(nativeResponses).to.be.an('array').that.is.not.empty;
|
|
147
|
+
|
|
148
|
+
let dataItem = nativeResponses[0];
|
|
149
|
+
expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
|
|
150
|
+
expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
|
|
151
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
152
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
153
|
+
expect(dataItem.native.clickUrl).to.equal('test.com');
|
|
154
|
+
expect(dataItem.native.title).to.equal('Test');
|
|
155
|
+
expect(dataItem.native.image).to.equal('test.com');
|
|
156
|
+
expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
|
|
157
|
+
expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
|
|
158
|
+
expect(dataItem.ttl).to.equal(120);
|
|
159
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
160
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
161
|
+
expect(dataItem.currency).to.equal('USD');
|
|
162
|
+
});
|
|
163
|
+
it('Should return an empty array if invalid banner response is passed', function () {
|
|
164
|
+
const invBanner = {
|
|
165
|
+
body: [{
|
|
166
|
+
width: 300,
|
|
167
|
+
cpm: 0.4,
|
|
168
|
+
ad: 'Test',
|
|
169
|
+
requestId: '23fhj33i987f',
|
|
170
|
+
ttl: 120,
|
|
171
|
+
creativeId: '2',
|
|
172
|
+
netRevenue: true,
|
|
173
|
+
currency: 'USD',
|
|
174
|
+
dealId: '1'
|
|
175
|
+
}]
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
let serverResponses = spec.interpretResponse(invBanner);
|
|
179
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
180
|
+
});
|
|
181
|
+
it('Should return an empty array if invalid video response is passed', function () {
|
|
182
|
+
const invVideo = {
|
|
183
|
+
body: [{
|
|
184
|
+
mediaType: 'video',
|
|
185
|
+
cpm: 0.5,
|
|
186
|
+
requestId: '23fhj33i987f',
|
|
187
|
+
ttl: 120,
|
|
188
|
+
creativeId: '2',
|
|
189
|
+
netRevenue: true,
|
|
190
|
+
currency: 'USD',
|
|
191
|
+
dealId: '1'
|
|
192
|
+
}]
|
|
193
|
+
};
|
|
194
|
+
let serverResponses = spec.interpretResponse(invVideo);
|
|
195
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
196
|
+
});
|
|
197
|
+
it('Should return an empty array if invalid native response is passed', function () {
|
|
198
|
+
const invNative = {
|
|
199
|
+
body: [{
|
|
200
|
+
mediaType: 'native',
|
|
201
|
+
clickUrl: 'test.com',
|
|
202
|
+
title: 'Test',
|
|
203
|
+
impressionTrackers: ['test.com'],
|
|
204
|
+
ttl: 120,
|
|
205
|
+
requestId: '23fhj33i987f',
|
|
206
|
+
creativeId: '2',
|
|
207
|
+
netRevenue: true,
|
|
208
|
+
currency: 'USD',
|
|
209
|
+
}]
|
|
210
|
+
};
|
|
211
|
+
let serverResponses = spec.interpretResponse(invNative);
|
|
212
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
213
|
+
});
|
|
214
|
+
it('Should return an empty array if invalid response is passed', function () {
|
|
215
|
+
const invalid = {
|
|
216
|
+
body: [{
|
|
217
|
+
ttl: 120,
|
|
218
|
+
creativeId: '2',
|
|
219
|
+
netRevenue: true,
|
|
220
|
+
currency: 'USD',
|
|
221
|
+
dealId: '1'
|
|
222
|
+
}]
|
|
223
|
+
};
|
|
224
|
+
let serverResponses = spec.interpretResponse(invalid);
|
|
225
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('getUserSyncs', function () {
|
|
229
|
+
let userSync = spec.getUserSyncs();
|
|
230
|
+
it('Returns valid URL and type', function () {
|
|
231
|
+
if (spec.noSync) {
|
|
232
|
+
expect(userSync).to.be.equal(false);
|
|
233
|
+
} else {
|
|
234
|
+
expect(userSync).to.be.an('array').with.lengthOf(1);
|
|
235
|
+
expect(userSync[0].type).to.exist;
|
|
236
|
+
expect(userSync[0].url).to.exist;
|
|
237
|
+
expect(userSync[0].type).to.be.equal('image');
|
|
238
|
+
expect(userSync[0].url).to.be.equal('https://service.e-volution.ai/?c=o&m=sync');
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
});
|
|
@@ -544,6 +544,52 @@ describe('gumgumAdapter', function () {
|
|
|
544
544
|
const bidRequest = spec.buildRequests(bidRequests)[0];
|
|
545
545
|
expect(!!bidRequest.data.lt).to.be.true;
|
|
546
546
|
});
|
|
547
|
+
|
|
548
|
+
it('should handle no gg params', function () {
|
|
549
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo¶m2=bar¶m3=baz' } })[0];
|
|
550
|
+
|
|
551
|
+
// no params are in object
|
|
552
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
|
|
553
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
554
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
it('should handle encrypted ad buy id', function () {
|
|
558
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=bar¶m3=baz' } })[0];
|
|
559
|
+
|
|
560
|
+
// correct params are in object
|
|
561
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
|
|
562
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
563
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
564
|
+
|
|
565
|
+
// params are stripped from pu property
|
|
566
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
it('should handle unencrypted ad buy id', function () {
|
|
570
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=123¶m3=baz' } })[0];
|
|
571
|
+
|
|
572
|
+
// correct params are in object
|
|
573
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
|
|
574
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.true;
|
|
575
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
576
|
+
|
|
577
|
+
// params are stripped from pu property
|
|
578
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
it('should handle multiple gg params', function () {
|
|
582
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?ggdeal=foo&ggad=bar¶m3=baz' } })[0];
|
|
583
|
+
|
|
584
|
+
// correct params are in object
|
|
585
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
|
|
586
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
587
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.true;
|
|
588
|
+
|
|
589
|
+
// params are stripped from pu property
|
|
590
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
591
|
+
expect(bidRequest.data.pu.includes('ggdeal')).to.be.false;
|
|
592
|
+
});
|
|
547
593
|
})
|
|
548
594
|
|
|
549
595
|
describe('interpretResponse', function () {
|