prebid.js 6.5.0 → 6.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/modules/.submodules.json +2 -1
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +23 -11
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/bliinkBidAdapter.js +2 -1
- package/modules/compassBidAdapter.js +9 -2
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/glimpseBidAdapter.js +66 -44
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +24 -2
- package/modules/nextMillenniumBidAdapter.js +3 -1
- package/modules/oguryBidAdapter.js +9 -2
- package/modules/onetagBidAdapter.js +4 -2
- package/modules/proxistoreBidAdapter.js +0 -2
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/richaudienceBidAdapter.js +3 -2
- package/modules/riseBidAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +6 -5
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/userId/eids.js +7 -1
- package/modules/userId/userId.md +8 -0
- package/modules/welectBidAdapter.js +106 -0
- package/package.json +1 -1
- package/src/hook.js +5 -1
- package/src/prebid.js +18 -4
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/compassBidAdapter_spec.js +1 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
- package/test/spec/modules/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +42 -0
- package/test/spec/modules/loglyliftBidAdapter_spec.js +1 -1
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/realTimeDataModule_spec.js +16 -3
- package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +1 -1
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/unit/pbjs_api_spec.js +3 -1
|
@@ -143,6 +143,7 @@ describe('CompassBidAdapter', function () {
|
|
|
143
143
|
expect(placement.bidId).to.be.a('string');
|
|
144
144
|
expect(placement.schain).to.be.an('object');
|
|
145
145
|
expect(placement.bidfloor).to.exist.and.to.equal(0);
|
|
146
|
+
expect(placement.type).to.exist.and.to.equal('publisher');
|
|
146
147
|
|
|
147
148
|
if (placement.adFormat === BANNER) {
|
|
148
149
|
expect(placement.sizes).to.be.an('array');
|
|
@@ -116,16 +116,19 @@ describe('CriteoId module', function () {
|
|
|
116
116
|
expect(setCookieStub.calledWith('cto_bundle')).to.be.false;
|
|
117
117
|
expect(setLocalStorageStub.calledWith('cto_bundle')).to.be.false;
|
|
118
118
|
} else if (response.bundle) {
|
|
119
|
-
expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs)).to.be.true;
|
|
119
|
+
expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs, null, '.com')).to.be.true;
|
|
120
|
+
expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs, null, '.testdev.com')).to.be.true;
|
|
120
121
|
expect(setLocalStorageStub.calledWith('cto_bundle', response.bundle)).to.be.true;
|
|
121
122
|
expect(triggerPixelStub.called).to.be.false;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
if (response.bidId) {
|
|
125
|
-
expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs)).to.be.true;
|
|
126
|
+
expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs, null, '.com')).to.be.true;
|
|
127
|
+
expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs, null, '.testdev.com')).to.be.true;
|
|
126
128
|
expect(setLocalStorageStub.calledWith('cto_bidid', response.bidId)).to.be.true;
|
|
127
129
|
} else {
|
|
128
|
-
expect(setCookieStub.calledWith('cto_bidid', '', pastDateString)).to.be.true;
|
|
130
|
+
expect(setCookieStub.calledWith('cto_bidid', '', pastDateString, null, '.com')).to.be.true;
|
|
131
|
+
expect(setCookieStub.calledWith('cto_bidid', '', pastDateString, null, '.testdev.com')).to.be.true;
|
|
129
132
|
expect(removeFromLocalStorageStub.calledWith('cto_bidid')).to.be.true;
|
|
130
133
|
}
|
|
131
134
|
});
|
|
@@ -348,6 +348,21 @@ describe('eids array generation for known sub-modules', function() {
|
|
|
348
348
|
}]
|
|
349
349
|
});
|
|
350
350
|
});
|
|
351
|
+
|
|
352
|
+
it('qid', function() {
|
|
353
|
+
const userId = {
|
|
354
|
+
qid: 'some-random-id-value'
|
|
355
|
+
};
|
|
356
|
+
const newEids = createEidsArray(userId);
|
|
357
|
+
expect(newEids.length).to.equal(1);
|
|
358
|
+
expect(newEids[0]).to.deep.equal({
|
|
359
|
+
source: 'adquery.io',
|
|
360
|
+
uids: [{
|
|
361
|
+
id: 'some-random-id-value',
|
|
362
|
+
atype: 1
|
|
363
|
+
}]
|
|
364
|
+
});
|
|
365
|
+
});
|
|
351
366
|
});
|
|
352
367
|
describe('Negative case', function() {
|
|
353
368
|
it('eids array generation for UN-known sub-module', function() {
|
|
@@ -178,24 +178,6 @@ describe('GlimpseProtocolAdapter', () => {
|
|
|
178
178
|
const bidRequests = [getBidRequest()]
|
|
179
179
|
const bidderRequest = getBidderRequest()
|
|
180
180
|
|
|
181
|
-
it('Adds a demo flag', () => {
|
|
182
|
-
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
183
|
-
const payload = JSON.parse(request.data)
|
|
184
|
-
expect(payload.data.demo).to.be.false
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
it('Adds an account id', () => {
|
|
188
|
-
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
189
|
-
const payload = JSON.parse(request.data)
|
|
190
|
-
expect(payload.data.account).to.equal(-1)
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
it('Adds a demand provider', () => {
|
|
194
|
-
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
195
|
-
const payload = JSON.parse(request.data)
|
|
196
|
-
expect(payload.data.demand).to.equal('glimpse')
|
|
197
|
-
})
|
|
198
|
-
|
|
199
181
|
it('Adds GDPR consent', () => {
|
|
200
182
|
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
201
183
|
const payload = JSON.parse(request.data)
|
|
@@ -3,15 +3,20 @@ import * as idImportlibrary from 'modules/idImportLibrary.js';
|
|
|
3
3
|
|
|
4
4
|
var expect = require('chai').expect;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const mockMutationObserver = {
|
|
7
|
+
observe: () => {
|
|
8
|
+
return null
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('IdImportLibrary Tests', function () {
|
|
13
|
+
let fakeServer;
|
|
8
14
|
let sandbox;
|
|
9
15
|
let clock;
|
|
10
|
-
|
|
11
16
|
let fn = sinon.spy();
|
|
12
17
|
|
|
13
18
|
beforeEach(function () {
|
|
14
|
-
|
|
19
|
+
fakeServer = sinon.fakeServer.create();
|
|
15
20
|
sinon.stub(utils, 'logInfo');
|
|
16
21
|
sinon.stub(utils, 'logError');
|
|
17
22
|
});
|
|
@@ -19,7 +24,7 @@ describe('currency', function () {
|
|
|
19
24
|
afterEach(function () {
|
|
20
25
|
utils.logInfo.restore();
|
|
21
26
|
utils.logError.restore();
|
|
22
|
-
|
|
27
|
+
fakeServer.restore();
|
|
23
28
|
idImportlibrary.setConfig({});
|
|
24
29
|
});
|
|
25
30
|
|
|
@@ -34,28 +39,210 @@ describe('currency', function () {
|
|
|
34
39
|
clock.restore();
|
|
35
40
|
});
|
|
36
41
|
|
|
37
|
-
it('results when no config
|
|
42
|
+
it('results when no config is set', function () {
|
|
43
|
+
idImportlibrary.setConfig();
|
|
44
|
+
sinon.assert.called(utils.logError);
|
|
45
|
+
});
|
|
46
|
+
it('results when config is empty', function () {
|
|
38
47
|
idImportlibrary.setConfig({});
|
|
39
48
|
sinon.assert.called(utils.logError);
|
|
40
49
|
});
|
|
41
|
-
it('results with config available', function () {
|
|
42
|
-
idImportlibrary.setConfig({ 'url': 'URL' });
|
|
50
|
+
it('results with config available with url and debounce', function () {
|
|
51
|
+
idImportlibrary.setConfig({ 'url': 'URL', 'debounce': 0 });
|
|
43
52
|
sinon.assert.called(utils.logInfo);
|
|
44
53
|
});
|
|
54
|
+
it('results with config debounce ', function () {
|
|
55
|
+
let config = { 'url': 'URL', 'debounce': 300 }
|
|
56
|
+
idImportlibrary.setConfig(config);
|
|
57
|
+
expect(config.debounce).to.be.equal(300);
|
|
58
|
+
});
|
|
59
|
+
|
|
45
60
|
it('results with config default debounce ', function () {
|
|
46
61
|
let config = { 'url': 'URL' }
|
|
47
62
|
idImportlibrary.setConfig(config);
|
|
48
63
|
expect(config.debounce).to.be.equal(250);
|
|
49
64
|
});
|
|
50
65
|
it('results with config default fullscan ', function () {
|
|
51
|
-
let config = { 'url': 'URL' }
|
|
66
|
+
let config = { 'url': 'URL', 'debounce': 0 }
|
|
52
67
|
idImportlibrary.setConfig(config);
|
|
53
68
|
expect(config.fullscan).to.be.equal(false);
|
|
54
69
|
});
|
|
55
70
|
it('results with config fullscan ', function () {
|
|
56
|
-
let config = { 'url': 'URL', 'fullscan': true }
|
|
71
|
+
let config = { 'url': 'URL', 'fullscan': true, 'debounce': 0 }
|
|
72
|
+
idImportlibrary.setConfig(config);
|
|
73
|
+
expect(config.fullscan).to.be.equal(true);
|
|
74
|
+
expect(config.inputscan).to.be.equal(false);
|
|
75
|
+
});
|
|
76
|
+
it('results with config inputscan ', function () {
|
|
77
|
+
let config = { 'inputscan': true, 'debounce': 0 }
|
|
78
|
+
idImportlibrary.setConfig(config);
|
|
79
|
+
expect(config.inputscan).to.be.equal(true);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('Test with email is found', function () {
|
|
83
|
+
let mutationObserverStub;
|
|
84
|
+
let userId;
|
|
85
|
+
let refreshUserIdSpy;
|
|
86
|
+
beforeEach(function() {
|
|
87
|
+
let sandbox = sinon.createSandbox();
|
|
88
|
+
refreshUserIdSpy = sinon.spy(window.$$PREBID_GLOBAL$$, 'refreshUserIds');
|
|
89
|
+
clock = sinon.useFakeTimers(1046952000000); // 2003-03-06T12:00:00Z
|
|
90
|
+
mutationObserverStub = sinon.stub(window, 'MutationObserver').returns(mockMutationObserver);
|
|
91
|
+
userId = sandbox.stub(window.$$PREBID_GLOBAL$$, 'getUserIds').returns({id: {'MOCKID': '1111'}});
|
|
92
|
+
fakeServer.respondWith('POST', 'URL', [200,
|
|
93
|
+
{
|
|
94
|
+
'Content-Type': 'application/json',
|
|
95
|
+
'Access-Control-Allow-Origin': '*'
|
|
96
|
+
},
|
|
97
|
+
''
|
|
98
|
+
]);
|
|
99
|
+
});
|
|
100
|
+
afterEach(function () {
|
|
101
|
+
sandbox.restore();
|
|
102
|
+
clock.restore();
|
|
103
|
+
userId.restore();
|
|
104
|
+
refreshUserIdSpy.restore();
|
|
105
|
+
mutationObserverStub.restore();
|
|
106
|
+
document.body.innerHTML = '';
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('results with config fullscan with email found in html ', function () {
|
|
110
|
+
document.body.innerHTML = '<body><div>test@test.com</div></body>';
|
|
111
|
+
let config = { 'url': 'URL', 'fullscan': true, 'debounce': 0 }
|
|
112
|
+
idImportlibrary.setConfig(config);
|
|
113
|
+
expect(config.fullscan).to.be.equal(true);
|
|
114
|
+
expect(config.inputscan).to.be.equal(false);
|
|
115
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(true);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('results with config fullscan with no email found in html ', function () {
|
|
119
|
+
document.body.innerHTML = '<body><div>test</div></body>';
|
|
120
|
+
let config = { 'url': 'URL', 'fullscan': true, 'debounce': 0 }
|
|
121
|
+
idImportlibrary.setConfig(config);
|
|
122
|
+
expect(config.fullscan).to.be.equal(true);
|
|
123
|
+
expect(config.inputscan).to.be.equal(false);
|
|
124
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('results with config formElementId without listner ', function () {
|
|
128
|
+
let config = { url: 'testUrl', 'formElementId': 'userid', 'debounce': 0 }
|
|
129
|
+
document.body.innerHTML = '<body><input type="text" id="userid" value="test@test.com"></body>';
|
|
130
|
+
idImportlibrary.setConfig(config);
|
|
131
|
+
expect(config.formElementId).to.be.equal('userid');
|
|
132
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('results with config formElementId with listner ', function () {
|
|
136
|
+
let config = { url: 'testUrl', 'formElementId': 'userid', 'debounce': 0 }
|
|
137
|
+
document.body.innerHTML = '<body><input type="text" id="userid" value=""></body>';
|
|
138
|
+
idImportlibrary.setConfig(config);
|
|
139
|
+
expect(config.formElementId).to.be.equal('userid');
|
|
140
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('results with config target without listner ', function () {
|
|
144
|
+
let config = { url: 'testUrl', 'target': 'userid', 'debounce': 0 }
|
|
145
|
+
document.body.innerHTML = '<body><div id="userid">test@test.com<div></div></body>';
|
|
146
|
+
idImportlibrary.setConfig(config);
|
|
147
|
+
expect(config.target).to.be.equal('userid');
|
|
148
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(true);
|
|
149
|
+
});
|
|
150
|
+
it('results with config target with listner ', function () {
|
|
151
|
+
let config = { url: 'testUrl', 'target': 'userid', 'debounce': 0 }
|
|
152
|
+
document.body.innerHTML = '<body><div id="userid"><div></div></body>';
|
|
153
|
+
idImportlibrary.setConfig(config);
|
|
154
|
+
|
|
155
|
+
expect(config.target).to.be.equal('userid');
|
|
156
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('results with config target with listner', function () {
|
|
160
|
+
let config = { url: 'testUrl', 'target': 'userid', 'debounce': 0 }
|
|
161
|
+
idImportlibrary.setConfig(config);
|
|
162
|
+
document.body.innerHTML = '<body><div id="userid">test@test.com<div></div></body>';
|
|
163
|
+
expect(config.target).to.be.equal('userid');
|
|
164
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
165
|
+
});
|
|
166
|
+
it('results with config fullscan ', function () {
|
|
167
|
+
let config = { url: 'testUrl', 'fullscan': true, 'debounce': 0 }
|
|
57
168
|
idImportlibrary.setConfig(config);
|
|
169
|
+
document.body.innerHTML = '<body><div id="userid"><div></div></body>';
|
|
58
170
|
expect(config.fullscan).to.be.equal(true);
|
|
171
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
172
|
+
});
|
|
173
|
+
it('results with config inputscan with listner', function () {
|
|
174
|
+
let config = { url: 'testUrl', 'inputscan': true, 'debounce': 0 }
|
|
175
|
+
var input = document.createElement('input');
|
|
176
|
+
input.setAttribute('type', 'text');
|
|
177
|
+
document.body.appendChild(input);
|
|
178
|
+
idImportlibrary.setConfig(config);
|
|
179
|
+
expect(config.inputscan).to.be.equal(true);
|
|
180
|
+
input.setAttribute('value', 'text@text.com');
|
|
181
|
+
const inputEvent = new InputEvent('blur');
|
|
182
|
+
input.dispatchEvent(inputEvent);
|
|
183
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(true);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('results with config inputscan with listner and no user ids ', function () {
|
|
187
|
+
let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
|
|
188
|
+
document.body.innerHTML = '<body><input id="userid" value=""></body>';
|
|
189
|
+
idImportlibrary.setConfig(config);
|
|
190
|
+
expect(config.inputscan).to.be.equal(true);
|
|
191
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it('results with config inputscan with listner ', function () {
|
|
195
|
+
let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
|
|
196
|
+
document.body.innerHTML = '<body><input id="userid" type=text value=""></body>';
|
|
197
|
+
idImportlibrary.setConfig(config);
|
|
198
|
+
expect(config.inputscan).to.be.equal(true);
|
|
199
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(false);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('results with config inputscan without listner ', function () {
|
|
203
|
+
let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
|
|
204
|
+
document.body.innerHTML = '<body><input id="userid" value="test@test.com"></body>';
|
|
205
|
+
idImportlibrary.setConfig(config);
|
|
206
|
+
expect(config.inputscan).to.be.equal(true);
|
|
207
|
+
expect(refreshUserIdSpy.calledOnce).to.equal(true);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
describe('Tests with no user ids', function () {
|
|
211
|
+
let mutationObserverStub;
|
|
212
|
+
let userId;
|
|
213
|
+
let jsonSpy;
|
|
214
|
+
beforeEach(function() {
|
|
215
|
+
let sandbox = sinon.createSandbox();
|
|
216
|
+
clock = sinon.useFakeTimers(1046952000000); // 2003-03-06T12:00:00Z
|
|
217
|
+
mutationObserverStub = sinon.stub(window, 'MutationObserver');
|
|
218
|
+
jsonSpy = sinon.spy(JSON, 'stringify');
|
|
219
|
+
fakeServer.respondWith('POST', 'URL', [200,
|
|
220
|
+
{
|
|
221
|
+
'Content-Type': 'application/json',
|
|
222
|
+
'Access-Control-Allow-Origin': '*'
|
|
223
|
+
},
|
|
224
|
+
''
|
|
225
|
+
]);
|
|
226
|
+
});
|
|
227
|
+
afterEach(function () {
|
|
228
|
+
sandbox.restore();
|
|
229
|
+
clock.restore();
|
|
230
|
+
jsonSpy.restore();
|
|
231
|
+
mutationObserverStub.restore();
|
|
232
|
+
});
|
|
233
|
+
it('results with config inputscan without listner with no user ids ', function () {
|
|
234
|
+
let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
|
|
235
|
+
document.body.innerHTML = '<body><input id="userid" value="test@test.com"></body>';
|
|
236
|
+
idImportlibrary.setConfig(config);
|
|
237
|
+
expect(config.inputscan).to.be.equal(true);
|
|
238
|
+
expect(jsonSpy.calledOnce).to.equal(false);
|
|
239
|
+
});
|
|
240
|
+
it('results with config inputscan without listner with no user ids ', function () {
|
|
241
|
+
let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
|
|
242
|
+
document.body.innerHTML = '<body><input id="userid"></body>';
|
|
243
|
+
idImportlibrary.setConfig(config);
|
|
244
|
+
expect(config.inputscan).to.be.equal(true);
|
|
245
|
+
expect(jsonSpy.calledOnce).to.equal(false);
|
|
59
246
|
});
|
|
60
247
|
});
|
|
61
248
|
});
|
|
@@ -515,6 +515,48 @@ describe('Improve Digital Adapter Tests', function () {
|
|
|
515
515
|
});
|
|
516
516
|
getConfigStub.restore();
|
|
517
517
|
});
|
|
518
|
+
|
|
519
|
+
it('should set pagecat and genre ➞ fpd:ortb2.site', function() {
|
|
520
|
+
config.setConfig(JSON.parse('{"ortb2":{"site":{"cat":["IAB2"],"pagecat":["IAB2-2"],"content":{"genre":"Adventure"}}}}'));
|
|
521
|
+
const bidRequest = Object.assign({}, simpleBidRequest);
|
|
522
|
+
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
|
|
523
|
+
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
|
|
524
|
+
expect(params.bid_request.pagecat).to.be.an('array');
|
|
525
|
+
expect(params.bid_request.pagecat).to.deep.equal(['IAB2-2']);
|
|
526
|
+
expect(params.bid_request.genre).to.be.a('string');
|
|
527
|
+
expect(params.bid_request.genre).be.equal('Adventure');
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it('should not set pagecat and genre when malformed data provided ➞ fpd:ortb2.site', function() {
|
|
531
|
+
config.setConfig(JSON.parse('{"ortb2":{"site":{"pagecat":"IAB2-2","content":{"genre":["Adventure"]}}}}'));
|
|
532
|
+
const bidRequest = Object.assign({}, simpleBidRequest);
|
|
533
|
+
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
|
|
534
|
+
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
|
|
535
|
+
expect(params.bid_request.pagecat).does.not.exist;
|
|
536
|
+
expect(params.bid_request.genre).does.not.exist;
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
it('should use cat when pagecat not available ➞ fpd:ortb2.site', function() {
|
|
540
|
+
config.setConfig(JSON.parse('{"ortb2":{"site":{"cat":["IAB2"]}}}'));
|
|
541
|
+
const bidRequest = Object.assign({}, simpleBidRequest);
|
|
542
|
+
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
|
|
543
|
+
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
|
|
544
|
+
expect(params.bid_request.pagecat).to.be.an('array');
|
|
545
|
+
expect(params.bid_request.pagecat).to.deep.equal(['IAB2']);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it('should format pagecat correctly ➞ fpd:ortb2.site', function() {
|
|
549
|
+
config.setConfig(JSON.parse('{"ortb2":{"site":{"cat":["IAB2", ["IAB-1"], "IAB3", 123, ""]}}}'));
|
|
550
|
+
const bidRequest = Object.assign({}, simpleBidRequest);
|
|
551
|
+
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
|
|
552
|
+
const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
|
|
553
|
+
expect(params.bid_request.pagecat).to.be.an('array');
|
|
554
|
+
expect(params.bid_request.pagecat).to.deep.equal([
|
|
555
|
+
'IAB2',
|
|
556
|
+
'IAB3'
|
|
557
|
+
]
|
|
558
|
+
);
|
|
559
|
+
});
|
|
518
560
|
});
|
|
519
561
|
|
|
520
562
|
const serverResponse = {
|
|
@@ -109,7 +109,7 @@ describe('loglyliftBidAdapter', function () {
|
|
|
109
109
|
expect(data.bidId).to.equal(nativeBidRequests[0].bidId);
|
|
110
110
|
expect(data.mediaTypes).to.deep.equal(nativeBidRequests[0].mediaTypes);
|
|
111
111
|
expect(data.params).to.deep.equal(nativeBidRequests[0].params);
|
|
112
|
-
expect(data.prebidJsVersion).to.equal('
|
|
112
|
+
expect(data.prebidJsVersion).to.equal('$prebid.version$');
|
|
113
113
|
expect(data.url).to.exist;
|
|
114
114
|
expect(data.domain).to.exist;
|
|
115
115
|
expect(data.referer).to.equal(bidderRequest.refererInfo.referer);
|
|
@@ -40,7 +40,7 @@ describe('nextMillenniumBidAdapterTests', function() {
|
|
|
40
40
|
|
|
41
41
|
it('Check if refresh_count param is incremented', function() {
|
|
42
42
|
const request = spec.buildRequests(bidRequestData);
|
|
43
|
-
expect(JSON.parse(request[0].data).refresh_count).to.equal(3);
|
|
43
|
+
expect(JSON.parse(request[0].data).ext.nextMillennium.refresh_count).to.equal(3);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it('Test getUserSyncs function', function () {
|
|
@@ -268,6 +268,10 @@ describe('OguryBidAdapter', function () {
|
|
|
268
268
|
ext: {
|
|
269
269
|
consent: bidderRequest.gdprConsent.consentString
|
|
270
270
|
},
|
|
271
|
+
},
|
|
272
|
+
ext: {
|
|
273
|
+
prebidversion: '$prebid.version$',
|
|
274
|
+
adapterversion: '1.2.7'
|
|
271
275
|
}
|
|
272
276
|
};
|
|
273
277
|
|
|
@@ -425,7 +429,9 @@ describe('OguryBidAdapter', function () {
|
|
|
425
429
|
meta: {
|
|
426
430
|
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
|
|
427
431
|
},
|
|
428
|
-
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl
|
|
432
|
+
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
|
|
433
|
+
adapterVersion: '1.2.7',
|
|
434
|
+
prebidVersion: '$prebid.version$'
|
|
429
435
|
}, {
|
|
430
436
|
requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
|
|
431
437
|
cpm: openRtbBidResponse.body.seatbid[0].bid[1].price,
|
|
@@ -440,7 +446,9 @@ describe('OguryBidAdapter', function () {
|
|
|
440
446
|
meta: {
|
|
441
447
|
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
|
|
442
448
|
},
|
|
443
|
-
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl
|
|
449
|
+
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
|
|
450
|
+
adapterVersion: '1.2.7',
|
|
451
|
+
prebidVersion: '$prebid.version$'
|
|
444
452
|
}]
|
|
445
453
|
|
|
446
454
|
let request = spec.buildRequests(bidRequests, bidderRequest);
|
|
@@ -95,6 +95,9 @@ const BID2 = Object.assign({}, BID, {
|
|
|
95
95
|
'hb_pb': '1.500',
|
|
96
96
|
'hb_size': '728x90',
|
|
97
97
|
'hb_source': 'server'
|
|
98
|
+
},
|
|
99
|
+
meta: {
|
|
100
|
+
advertiserDomains: ['example.com']
|
|
98
101
|
}
|
|
99
102
|
});
|
|
100
103
|
|
|
@@ -382,6 +385,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
382
385
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
383
386
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
384
387
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
388
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
385
389
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
386
390
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
387
391
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -651,6 +655,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
651
655
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
652
656
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
653
657
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
658
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
654
659
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
655
660
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
656
661
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -708,6 +713,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
708
713
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
709
714
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
710
715
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
716
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
711
717
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
712
718
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
713
719
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -754,6 +760,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
754
760
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
755
761
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
756
762
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
763
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
757
764
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
758
765
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
759
766
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -771,9 +778,10 @@ describe('pubmatic analytics adapter', function () {
|
|
|
771
778
|
expect(data.kgpv).to.equal('*');
|
|
772
779
|
});
|
|
773
780
|
|
|
774
|
-
it('Logger: regexPattern in bid.bidResponse', function() {
|
|
781
|
+
it('Logger: regexPattern in bid.bidResponse and url in adomain', function() {
|
|
775
782
|
const BID2_COPY = utils.deepClone(BID2);
|
|
776
783
|
BID2_COPY.regexPattern = '*';
|
|
784
|
+
BID2_COPY.meta.advertiserDomains = ['https://www.example.com/abc/223']
|
|
777
785
|
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
778
786
|
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
779
787
|
events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
|
|
@@ -808,6 +816,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
808
816
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
809
817
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
810
818
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
819
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
811
820
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
812
821
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
813
822
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -859,6 +868,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
859
868
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
860
869
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
861
870
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
871
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
862
872
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
863
873
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
864
874
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -912,6 +922,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
912
922
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
913
923
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
914
924
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
925
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
915
926
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
916
927
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
917
928
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -1011,6 +1022,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1011
1022
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
1012
1023
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
1013
1024
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
1025
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
1014
1026
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
1015
1027
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
1016
1028
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -3,6 +3,7 @@ import {config} from 'src/config.js';
|
|
|
3
3
|
import * as sinon from 'sinon';
|
|
4
4
|
import {default as CONSTANTS} from '../../../src/constants.json';
|
|
5
5
|
import {default as events} from '../../../src/events.js';
|
|
6
|
+
import 'src/prebid.js';
|
|
6
7
|
|
|
7
8
|
const getBidRequestDataSpy = sinon.spy();
|
|
8
9
|
|
|
@@ -195,7 +196,7 @@ describe('Real time module', function () {
|
|
|
195
196
|
'name': 'tp1',
|
|
196
197
|
},
|
|
197
198
|
{
|
|
198
|
-
'name': 'tp2'
|
|
199
|
+
'name': 'tp2',
|
|
199
200
|
}
|
|
200
201
|
]
|
|
201
202
|
}
|
|
@@ -206,7 +207,7 @@ describe('Real time module', function () {
|
|
|
206
207
|
function eventHandlingProvider(name) {
|
|
207
208
|
const provider = {
|
|
208
209
|
name: name,
|
|
209
|
-
init: () => true
|
|
210
|
+
init: () => true,
|
|
210
211
|
}
|
|
211
212
|
Object.values(EVENTS).forEach((ev) => provider[ev] = sinon.spy());
|
|
212
213
|
return provider;
|
|
@@ -222,7 +223,19 @@ describe('Real time module', function () {
|
|
|
222
223
|
afterEach(() => {
|
|
223
224
|
_detachers.forEach((d) => d())
|
|
224
225
|
config.resetConfig();
|
|
225
|
-
})
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it('should set targeting for auctionEnd', () => {
|
|
229
|
+
providers.forEach(p => p.getTargetingData = sinon.spy());
|
|
230
|
+
const auction = {
|
|
231
|
+
adUnitCodes: ['a1'],
|
|
232
|
+
adUnits: [{code: 'a1'}]
|
|
233
|
+
};
|
|
234
|
+
mockEmitEvent(CONSTANTS.EVENTS.AUCTION_END, auction);
|
|
235
|
+
providers.forEach(p => {
|
|
236
|
+
expect(p.getTargetingData.calledWith(auction.adUnitCodes)).to.be.true;
|
|
237
|
+
});
|
|
238
|
+
});
|
|
226
239
|
|
|
227
240
|
Object.entries(EVENTS).forEach(([event, hook]) => {
|
|
228
241
|
it(`'${event}' should be propagated to providers through '${hook}'`, () => {
|
|
@@ -791,6 +791,46 @@ describe('Richaudience adapter tests', function () {
|
|
|
791
791
|
})).to.equal(true);
|
|
792
792
|
});
|
|
793
793
|
|
|
794
|
+
it('should pass schain', function() {
|
|
795
|
+
let schain = {
|
|
796
|
+
'ver': '1.0',
|
|
797
|
+
'complete': 1,
|
|
798
|
+
'nodes': [{
|
|
799
|
+
'asi': 'richaudience.com',
|
|
800
|
+
'sid': '00001',
|
|
801
|
+
'hp': 1
|
|
802
|
+
}, {
|
|
803
|
+
'asi': 'richaudience-2.com',
|
|
804
|
+
'sid': '00002',
|
|
805
|
+
'hp': 1
|
|
806
|
+
}]
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
DEFAULT_PARAMS_NEW_SIZES[0].schain = {
|
|
810
|
+
'ver': '1.0',
|
|
811
|
+
'complete': 1,
|
|
812
|
+
'nodes': [{
|
|
813
|
+
'asi': 'richaudience.com',
|
|
814
|
+
'sid': '00001',
|
|
815
|
+
'hp': 1
|
|
816
|
+
}, {
|
|
817
|
+
'asi': 'richaudience-2.com',
|
|
818
|
+
'sid': '00002',
|
|
819
|
+
'hp': 1
|
|
820
|
+
}]
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
|
|
824
|
+
gdprConsent: {
|
|
825
|
+
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
|
|
826
|
+
gdprApplies: true
|
|
827
|
+
},
|
|
828
|
+
refererInfo: {}
|
|
829
|
+
})
|
|
830
|
+
const requestContent = JSON.parse(request[0].data);
|
|
831
|
+
expect(requestContent).to.have.property('schain').to.deep.equal(schain);
|
|
832
|
+
})
|
|
833
|
+
|
|
794
834
|
describe('userSync', function () {
|
|
795
835
|
it('Verifies user syncs iframe include', function () {
|
|
796
836
|
config.setConfig({
|
|
@@ -257,7 +257,7 @@ describe('riseAdapter', function () {
|
|
|
257
257
|
const requests = spec.buildRequests(bidRequests, bidderRequest);
|
|
258
258
|
for (const request of requests) {
|
|
259
259
|
expect(request.data).to.be.an('object');
|
|
260
|
-
expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001
|
|
260
|
+
expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001,1,,,');
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
|
|
@@ -68,6 +68,7 @@ describe('RTBHouseAdapter', () => {
|
|
|
68
68
|
'params': {
|
|
69
69
|
'publisherId': 'PREBID_TEST',
|
|
70
70
|
'region': 'prebid-eu',
|
|
71
|
+
'channel': 'Partner_Site - news',
|
|
71
72
|
'test': 1
|
|
72
73
|
},
|
|
73
74
|
'adUnitCode': 'adunit-code',
|
|
@@ -101,6 +102,25 @@ describe('RTBHouseAdapter', () => {
|
|
|
101
102
|
expect(JSON.parse(builtTestRequest).test).to.equal(1);
|
|
102
103
|
});
|
|
103
104
|
|
|
105
|
+
it('should build channel param into request.site', () => {
|
|
106
|
+
let builtTestRequest = spec.buildRequests(bidRequests, bidderRequest).data;
|
|
107
|
+
expect(JSON.parse(builtTestRequest).site.channel).to.equal('Partner_Site - news');
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('should not build channel param into request.site if no value is passed', () => {
|
|
111
|
+
let bidRequest = Object.assign([], bidRequests);
|
|
112
|
+
bidRequest[0].params.channel = undefined;
|
|
113
|
+
let builtTestRequest = spec.buildRequests(bidRequest, bidderRequest).data;
|
|
114
|
+
expect(JSON.parse(builtTestRequest).site.channel).to.be.undefined
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it('should cap the request.site.channel length to 50', () => {
|
|
118
|
+
let bidRequest = Object.assign([], bidRequests);
|
|
119
|
+
bidRequest[0].params.channel = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent scelerisque ipsum eu purus lobortis iaculis.';
|
|
120
|
+
let builtTestRequest = spec.buildRequests(bidRequest, bidderRequest).data;
|
|
121
|
+
expect(JSON.parse(builtTestRequest).site.channel.length).to.equal(50)
|
|
122
|
+
})
|
|
123
|
+
|
|
104
124
|
it('should build valid OpenRTB banner object', () => {
|
|
105
125
|
const request = JSON.parse(spec.buildRequests(bidRequests, bidderRequest).data);
|
|
106
126
|
const imp = request.imp[0];
|