prebid.js 5.17.0 → 5.18.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.
Files changed (41) hide show
  1. package/modules/adgenerationBidAdapter.js +28 -4
  2. package/modules/adkernelBidAdapter.js +2 -1
  3. package/modules/admixerBidAdapter.js +11 -0
  4. package/modules/aolBidAdapter.js +2 -1
  5. package/modules/bliinkBidAdapter.js +58 -32
  6. package/modules/bliinkBidAdapter.md +29 -6
  7. package/modules/cwireBidAdapter.js +272 -0
  8. package/modules/cwireBidAdapter.md +43 -0
  9. package/modules/dgkeywordRtdProvider.js +0 -1
  10. package/modules/livewrappedAnalyticsAdapter.js +4 -2
  11. package/modules/mediakeysBidAdapter.js +2 -1
  12. package/modules/nativoBidAdapter.js +1 -1
  13. package/modules/oguryBidAdapter.js +22 -6
  14. package/modules/pixfutureBidAdapter.js +24 -4
  15. package/modules/pixfutureBidAdapter.md +127 -0
  16. package/modules/prebidServerBidAdapter/index.js +1 -1
  17. package/modules/proxistoreBidAdapter.js +4 -6
  18. package/modules/pubmaticBidAdapter.js +9 -0
  19. package/modules/pubmaticBidAdapter.md +1 -1
  20. package/modules/talkadsBidAdapter.js +129 -0
  21. package/modules/talkadsBidAdapter.md +60 -0
  22. package/modules/unicornBidAdapter.js +3 -3
  23. package/modules/visxBidAdapter.js +15 -22
  24. package/modules/yahoosspBidAdapter.js +637 -0
  25. package/modules/yahoosspBidAdapter.md +795 -0
  26. package/modules/yieldlabBidAdapter.js +48 -3
  27. package/modules/yieldlabBidAdapter.md +16 -1
  28. package/package.json +1 -1
  29. package/test/spec/modules/adgenerationBidAdapter_spec.js +121 -50
  30. package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
  31. package/test/spec/modules/cwireBidAdapter_spec.js +246 -0
  32. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +17 -7
  33. package/test/spec/modules/oguryBidAdapter_spec.js +72 -25
  34. package/test/spec/modules/pubmaticBidAdapter_spec.js +39 -1
  35. package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
  36. package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
  37. package/test/spec/modules/visxBidAdapter_spec.js +48 -4
  38. package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
  39. package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
  40. package/modules/turktelekomBidAdapter.md +0 -49
  41. package/yarn.lock +0 -13122
@@ -2,7 +2,8 @@ import { expect } from 'chai';
2
2
  import { spec } from 'modules/oguryBidAdapter';
3
3
  import { deepClone } from 'src/utils.js';
4
4
 
5
- const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
5
+ const BID_URL = 'https://mweb-hb.presage.io/api/header-bidding-request';
6
+ const TIMEOUT_URL = 'https://ms-ads-monitoring-events.presage.io/bid_timeout'
6
7
 
7
8
  describe('OguryBidAdapter', function () {
8
9
  let bidRequests;
@@ -118,22 +119,26 @@ describe('OguryBidAdapter', function () {
118
119
  };
119
120
  });
120
121
 
121
- it('should return syncs array with an element of type image', () => {
122
+ it('should return sync array with two elements of type image', () => {
122
123
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
123
124
 
124
- expect(userSyncs).to.have.lengthOf(1);
125
+ expect(userSyncs).to.have.lengthOf(2);
125
126
  expect(userSyncs[0].type).to.equal('image');
126
127
  expect(userSyncs[0].url).to.contain('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch');
128
+ expect(userSyncs[1].type).to.equal('image');
129
+ expect(userSyncs[1].url).to.contain('https://ms-cookie-sync.presage.io/ttd/init-sync');
127
130
  });
128
131
 
129
- it('should set the source as query param', () => {
132
+ it('should set the same source as query param', () => {
130
133
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
131
134
  expect(userSyncs[0].url).to.contain('source=prebid');
135
+ expect(userSyncs[1].url).to.contain('source=prebid');
132
136
  });
133
137
 
134
138
  it('should set the tcString as query param', () => {
135
139
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
136
140
  expect(userSyncs[0].url).to.contain(`iab_string=${gdprConsent.consentString}`);
141
+ expect(userSyncs[1].url).to.contain(`iab_string=${gdprConsent.consentString}`);
137
142
  });
138
143
 
139
144
  it('should return an empty array when pixel is disable', () => {
@@ -141,70 +146,82 @@ describe('OguryBidAdapter', function () {
141
146
  expect(spec.getUserSyncs(syncOptions, [], gdprConsent)).to.have.lengthOf(0);
142
147
  });
143
148
 
144
- it('should return syncs array with an element of type image when consentString is undefined', () => {
149
+ it('should return sync array with two elements of type image when consentString is undefined', () => {
145
150
  gdprConsent = {
146
151
  gdprApplies: true,
147
152
  consentString: undefined
148
153
  };
149
154
 
150
155
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
151
- expect(userSyncs).to.have.lengthOf(1);
156
+ expect(userSyncs).to.have.lengthOf(2);
152
157
  expect(userSyncs[0].type).to.equal('image');
153
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
158
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
159
+ expect(userSyncs[1].type).to.equal('image');
160
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
154
161
  });
155
162
 
156
- it('should return syncs array with an element of type image when consentString is null', () => {
163
+ it('should return sync array with two elements of type image when consentString is null', () => {
157
164
  gdprConsent = {
158
165
  gdprApplies: true,
159
166
  consentString: null
160
167
  };
161
168
 
162
169
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
163
- expect(userSyncs).to.have.lengthOf(1);
170
+ expect(userSyncs).to.have.lengthOf(2);
164
171
  expect(userSyncs[0].type).to.equal('image');
165
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
172
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
173
+ expect(userSyncs[1].type).to.equal('image');
174
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
166
175
  });
167
176
 
168
- it('should return syncs array with an element of type image when gdprConsent is undefined', () => {
177
+ it('should return sync array with two elements of type image when gdprConsent is undefined', () => {
169
178
  gdprConsent = undefined;
170
179
 
171
180
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
172
- expect(userSyncs).to.have.lengthOf(1);
181
+ expect(userSyncs).to.have.lengthOf(2);
173
182
  expect(userSyncs[0].type).to.equal('image');
174
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
183
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
184
+ expect(userSyncs[1].type).to.equal('image');
185
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
175
186
  });
176
187
 
177
- it('should return syncs array with an element of type image when gdprConsent is null', () => {
188
+ it('should return sync array with two elements of type image when gdprConsent is null', () => {
178
189
  gdprConsent = null;
179
190
 
180
191
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
181
- expect(userSyncs).to.have.lengthOf(1);
192
+ expect(userSyncs).to.have.lengthOf(2);
182
193
  expect(userSyncs[0].type).to.equal('image');
183
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
194
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
195
+ expect(userSyncs[1].type).to.equal('image');
196
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
184
197
  });
185
198
 
186
- it('should return syncs array with an element of type image when gdprConsent is null and gdprApplies is false', () => {
199
+ it('should return sync array with two elements of type image when gdprConsent is null and gdprApplies is false', () => {
187
200
  gdprConsent = {
188
201
  gdprApplies: false,
189
202
  consentString: null
190
203
  };
191
204
 
192
205
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
193
- expect(userSyncs).to.have.lengthOf(1);
206
+ expect(userSyncs).to.have.lengthOf(2);
194
207
  expect(userSyncs[0].type).to.equal('image');
195
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
208
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
209
+ expect(userSyncs[1].type).to.equal('image');
210
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
196
211
  });
197
212
 
198
- it('should return syncs array with an element of type image when gdprConsent is empty string and gdprApplies is false', () => {
213
+ it('should return sync array with two elements of type image when gdprConsent is empty string and gdprApplies is false', () => {
199
214
  gdprConsent = {
200
215
  gdprApplies: false,
201
216
  consentString: ''
202
217
  };
203
218
 
204
219
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
205
- expect(userSyncs).to.have.lengthOf(1);
220
+ expect(userSyncs).to.have.lengthOf(2);
206
221
  expect(userSyncs[0].type).to.equal('image');
207
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
222
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
223
+ expect(userSyncs[1].type).to.equal('image');
224
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
208
225
  });
209
226
  });
210
227
 
@@ -243,6 +260,7 @@ describe('OguryBidAdapter', function () {
243
260
  site: {
244
261
  id: bidRequests[0].params.assetKey,
245
262
  domain: window.location.hostname,
263
+ page: window.location.href
246
264
  },
247
265
  user: {
248
266
  ext: {
@@ -255,7 +273,7 @@ describe('OguryBidAdapter', function () {
255
273
  const validBidRequests = deepClone(bidRequests)
256
274
 
257
275
  const request = spec.buildRequests(validBidRequests, bidderRequest);
258
- expect(request.url).to.equal(BID_HOST);
276
+ expect(request.url).to.equal(BID_URL);
259
277
  expect(request.method).to.equal('POST');
260
278
  });
261
279
 
@@ -453,11 +471,11 @@ describe('OguryBidAdapter', function () {
453
471
  })
454
472
 
455
473
  afterEach(function() {
456
- xhr.restore();
474
+ xhr.restore()
457
475
  })
458
476
 
459
477
  it('Should not create nurl request if bid is undefined', function() {
460
- spec.onBidWon();
478
+ spec.onBidWon()
461
479
  expect(requests.length).to.equal(0);
462
480
  })
463
481
 
@@ -473,4 +491,33 @@ describe('OguryBidAdapter', function () {
473
491
  expect(requests[0].method).to.equal('GET')
474
492
  })
475
493
  })
494
+
495
+ describe('onTimeout', function () {
496
+ let xhr;
497
+ let requests;
498
+
499
+ beforeEach(function() {
500
+ xhr = sinon.useFakeXMLHttpRequest();
501
+ requests = [];
502
+ xhr.onCreate = (xhr) => {
503
+ requests.push(xhr);
504
+ };
505
+ })
506
+
507
+ afterEach(function() {
508
+ xhr.restore()
509
+ })
510
+
511
+ it('should send notification on bid timeout', function() {
512
+ const bid = {
513
+ ad: '<img style="width: 300px; height: 250px;" src="https://assets.afcdn.com/recipe/20190529/93153_w1024h768c1cx2220cy1728cxt0cyt0cxb4441cyb3456.jpg" alt="cookies" />',
514
+ cpm: 3
515
+ }
516
+ spec.onTimeout(bid);
517
+ expect(requests).to.not.be.undefined;
518
+ expect(requests.length).to.equal(1);
519
+ expect(requests[0].url).to.equal(TIMEOUT_URL);
520
+ expect(requests[0].method).to.equal('POST');
521
+ })
522
+ });
476
523
  });
@@ -1,5 +1,5 @@
1
1
  import {expect} from 'chai';
2
- import {spec} from 'modules/pubmaticBidAdapter.js';
2
+ import {spec, checkVideoPlacement} from 'modules/pubmaticBidAdapter.js';
3
3
  import * as utils from 'src/utils.js';
4
4
  import {config} from 'src/config.js';
5
5
  import { createEidsArray } from 'modules/userId/eids.js';
@@ -3822,5 +3822,43 @@ describe('PubMatic adapter', function () {
3822
3822
  expect(bidRequests[0].params.dctr).to.equal('key1:val1,val2|key2:val1');
3823
3823
  });
3824
3824
  })
3825
+
3826
+ describe('Checking for Video.Placement property', function() {
3827
+ let sandbox, utilsMock;
3828
+ const adUnit = 'Div1';
3829
+ const msg_placement_missing = 'Video.Placement param missing for Div1';
3830
+ let videoData = {
3831
+ battr: [6, 7],
3832
+ skipafter: 15,
3833
+ maxduration: 50,
3834
+ context: 'instream',
3835
+ playerSize: [640, 480],
3836
+ skip: 0,
3837
+ connectiontype: [1, 2, 6],
3838
+ skipmin: 10,
3839
+ minduration: 10,
3840
+ mimes: ['video/mp4', 'video/x-flv'],
3841
+ }
3842
+ beforeEach(() => {
3843
+ utilsMock = sinon.mock(utils);
3844
+ sandbox = sinon.sandbox.create();
3845
+ sandbox.spy(utils, 'logWarn');
3846
+ });
3847
+
3848
+ afterEach(() => {
3849
+ utilsMock.restore();
3850
+ sandbox.restore();
3851
+ })
3852
+
3853
+ it('should log Video.Placement param missing', function() {
3854
+ checkVideoPlacement(videoData, adUnit);
3855
+ sinon.assert.calledWith(utils.logWarn, msg_placement_missing);
3856
+ })
3857
+ it('shoud not log Video.Placement param missing', function() {
3858
+ videoData['placement'] = 1;
3859
+ checkVideoPlacement(videoData, adUnit);
3860
+ sinon.assert.neverCalledWith(utils.logWarn, msg_placement_missing);
3861
+ })
3862
+ });
3825
3863
  });
3826
3864
  });
@@ -0,0 +1,231 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/talkadsBidAdapter.js';
3
+ import {newBidder} from 'src/adapters/bidderFactory.js';
4
+ import {config} from '../../../src/config';
5
+ import {server} from '../../mocks/xhr';
6
+
7
+ describe('TalkAds adapter', function () {
8
+ const commonBidderRequest = {
9
+ refererInfo: {
10
+ referer: 'https://example.com/'
11
+ },
12
+ timeout: 3000,
13
+ }
14
+ const commonBidRequest = {
15
+ bidder: 'talkads',
16
+ params: {
17
+ tag_id: 999999,
18
+ bidder_url: 'https://test.natexo-programmatic.com/tad/tag/prebid',
19
+ },
20
+ bidId: '1a2b3c4d56e7f0',
21
+ auctionId: '12345678-1234-1a2b-3c4d-1a2b3c4d56e7',
22
+ transactionId: '4f68b713-04ba-4d7f-8df9-643bcdab5efb',
23
+ };
24
+ const nativeBidRequestParams = {
25
+ nativeParams: {},
26
+ };
27
+ const bannerBidRequestParams = {
28
+ sizes: [[300, 250], [300, 600]],
29
+ };
30
+
31
+ /**
32
+ * isBidRequestValid
33
+ */
34
+ describe('isBidRequestValid1', function() {
35
+ it('should fail when config is invalid', function () {
36
+ const bidRequest = {
37
+ ...commonBidRequest,
38
+ ...bannerBidRequestParams,
39
+ };
40
+ bidRequest.params = Object.assign({}, bidRequest.params);
41
+ delete bidRequest.params;
42
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
43
+ });
44
+ }); // isBidRequestValid1
45
+ describe('isBidRequestValid2', function() {
46
+ it('should fail when config is invalid', function () {
47
+ const bidRequest = {
48
+ ...commonBidRequest,
49
+ ...bannerBidRequestParams,
50
+ };
51
+ bidRequest.params = Object.assign({}, bidRequest.params);
52
+ delete bidRequest.params.bidder_url;
53
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
54
+ });
55
+ }); // isBidRequestValid2
56
+ describe('isBidRequestValid3', function() {
57
+ it('should fail when config is invalid', function () {
58
+ const bidRequest = {
59
+ ...commonBidRequest,
60
+ ...bannerBidRequestParams,
61
+ };
62
+ bidRequest.params = Object.assign({}, bidRequest.params);
63
+ delete bidRequest.params.tag_id;
64
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
65
+ });
66
+ }); // isBidRequestValid3
67
+ describe('isBidRequestValid4', function() {
68
+ let bidRequest = {
69
+ ...commonBidRequest,
70
+ ...bannerBidRequestParams,
71
+ };
72
+ it('should succeed when a banner bid is valid', function () {
73
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
74
+ });
75
+ bidRequest = {
76
+ ...commonBidRequest,
77
+ ...nativeBidRequestParams,
78
+ };
79
+ it('should succeed when a native bid is valid', function () {
80
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
81
+ });
82
+ }); // isBidRequestValid4
83
+
84
+ /**
85
+ * buildRequests
86
+ */
87
+ describe('buildRequests1', function() {
88
+ let bidRequest = {
89
+ ...commonBidRequest,
90
+ ...bannerBidRequestParams,
91
+ };
92
+ const loServerRequest = {
93
+ cur: 'EUR',
94
+ timeout: commonBidderRequest.timeout,
95
+ auction_id: commonBidRequest.auctionId,
96
+ transaction_id: commonBidRequest.transactionId,
97
+ bids: [{ id: 0, bid_id: commonBidRequest.bidId, type: 'banner', size: bannerBidRequestParams.sizes }],
98
+ gdpr: { applies: false, consent: false },
99
+ };
100
+ it('should generate a valid banner bid request', function () {
101
+ let laResponse = spec.buildRequests([bidRequest], commonBidderRequest);
102
+ expect(laResponse.method).to.equal('POST');
103
+ expect(laResponse.url).to.equal('https://test.natexo-programmatic.com/tad/tag/prebid/999999');
104
+ expect(laResponse.data).to.equal(JSON.stringify(loServerRequest));
105
+ });
106
+ }); // buildRequests1
107
+ describe('buildRequests2', function() {
108
+ let bidRequest = {
109
+ ...commonBidRequest,
110
+ ...nativeBidRequestParams,
111
+ };
112
+ const loServerRequest = {
113
+ cur: 'EUR',
114
+ timeout: commonBidderRequest.timeout,
115
+ auction_id: commonBidRequest.auctionId,
116
+ transaction_id: commonBidRequest.transactionId,
117
+ bids: [{ id: 0, bid_id: commonBidRequest.bidId, type: 'native', size: [] }],
118
+ gdpr: { applies: false, consent: false },
119
+ };
120
+ it('should generate a valid native bid request', function () {
121
+ let laResponse = spec.buildRequests([bidRequest], commonBidderRequest);
122
+ expect(laResponse.method).to.equal('POST');
123
+ expect(laResponse.url).to.equal('https://test.natexo-programmatic.com/tad/tag/prebid/999999');
124
+ expect(laResponse.data).to.equal(JSON.stringify(loServerRequest));
125
+ });
126
+ const bidderRequest = {
127
+ ...commonBidderRequest,
128
+ gdprConsent: { gdprApplies: true, consentString: 'yes' }
129
+ };
130
+ const loServerRequest2 = {
131
+ ...loServerRequest,
132
+ gdpr: { applies: true, consent: 'yes' },
133
+ };
134
+ it('should generate a valid native bid request', function () {
135
+ let laResponse = spec.buildRequests([bidRequest], bidderRequest);
136
+ expect(laResponse.method).to.equal('POST');
137
+ expect(laResponse.url).to.equal('https://test.natexo-programmatic.com/tad/tag/prebid/999999');
138
+ expect(laResponse.data).to.equal(JSON.stringify(loServerRequest2));
139
+ });
140
+ }); // buildRequests2
141
+
142
+ /**
143
+ * interpretResponse
144
+ */
145
+ describe('interpretResponse1', function() {
146
+ it('should return empty array if no valid bids', function () {
147
+ const laResult = spec.interpretResponse({}, [])
148
+ expect(laResult).to.be.an('array').that.is.empty;
149
+ });
150
+ const loServerResult = {
151
+ body: { status: 'error', error: 'aie' }
152
+ };
153
+ it('should return empty array if there is an error', function () {
154
+ const laResult = spec.interpretResponse(loServerResult, [])
155
+ expect(laResult).to.be.an('array').that.is.empty;
156
+ });
157
+ }); // interpretResponse1
158
+ describe('interpretResponse2', function() {
159
+ const loServerResult = {
160
+ body: {
161
+ status: 'ok',
162
+ error: '',
163
+ pbid: '6147833a65749742875ace47',
164
+ bids: [{
165
+ requestId: commonBidRequest.bidId,
166
+ cpm: 0.10,
167
+ currency: 'EUR',
168
+ width: 300,
169
+ height: 250,
170
+ ad: 'test ad',
171
+ ttl: 60,
172
+ creativeId: 'c123a456',
173
+ netRevenue: false,
174
+ }]
175
+ }
176
+ };
177
+ const loExpected = [{
178
+ requestId: '1a2b3c4d56e7f0',
179
+ cpm: 0.1,
180
+ currency: 'EUR',
181
+ width: 300,
182
+ height: 250,
183
+ ad: 'test ad',
184
+ ttl: 60,
185
+ creativeId: 'c123a456',
186
+ netRevenue: false,
187
+ pbid: '6147833a65749742875ace47'
188
+ }];
189
+ it('should return a correct bid response', function () {
190
+ const laResult = spec.interpretResponse(loServerResult, [])
191
+ expect(JSON.stringify(laResult)).to.equal(JSON.stringify(loExpected));
192
+ });
193
+ }); // interpretResponse2
194
+
195
+ /**
196
+ * onBidWon
197
+ */
198
+ describe('onBidWon', function() {
199
+ it('should not make an ajax call if pbid is null', function () {
200
+ const loBid = {
201
+ requestId: '1a2b3c4d56e7f0',
202
+ cpm: 0.1,
203
+ currency: 'EUR',
204
+ width: 300,
205
+ height: 250,
206
+ ad: 'test ad',
207
+ ttl: 60,
208
+ creativeId: 'c123a456',
209
+ netRevenue: false,
210
+ }
211
+ spec.onBidWon(loBid)
212
+ expect(server.requests.length).to.equals(0);
213
+ });
214
+ it('should make an ajax call', function () {
215
+ const loBid = {
216
+ requestId: '1a2b3c4d56e7f0',
217
+ cpm: 0.1,
218
+ currency: 'EUR',
219
+ width: 300,
220
+ height: 250,
221
+ ad: 'test ad',
222
+ ttl: 60,
223
+ creativeId: 'c123a456',
224
+ netRevenue: false,
225
+ pbid: '6147833a65749742875ace47'
226
+ }
227
+ spec.onBidWon(loBid)
228
+ expect(server.requests[0].url).to.equals('https://test.natexo-programmatic.com/tad/tag/prebidwon/6147833a65749742875ace47');
229
+ });
230
+ }); // onBidWon
231
+ });
@@ -332,14 +332,14 @@ const openRTBRequest = {
332
332
  tagid: 'rectangle-ad-2'
333
333
  }
334
334
  ],
335
- cur: 'JPY',
335
+ cur: ['JPY'],
336
336
  ext: {
337
337
  accountId: 12345
338
338
  },
339
339
  site: {
340
340
  id: 'example',
341
341
  publisher: {
342
- id: 99999
342
+ id: '99999'
343
343
  },
344
344
  domain: 'uni-corn.net',
345
345
  page: 'https://uni-corn.net/',
@@ -357,7 +357,7 @@ const openRTBRequest = {
357
357
  ext: {
358
358
  stype: 'prebid_uncn',
359
359
  bidder: 'unicorn',
360
- prebid_version: '1.0'
360
+ prebid_version: '1.1'
361
361
  }
362
362
  }
363
363
  };
@@ -444,7 +444,7 @@ const serverResponse = {
444
444
  const request = {
445
445
  method: 'POST',
446
446
  url: 'https://ds.uncn.jp/pb/0/bid.json',
447
- data: '{"id":"5ebea288-f13a-4754-be6d-4ade66c68877","at":1,"imp":[{"id":"216255f234b602","banner":{"w":300,"h":250},"format":[{"w":300,"h":250},{"w":336,"h":280}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-0"},{"id":"31e2b28ced2475","banner":{"w":"300","h":"250"},"format":[{"w":"300","h":"250"}],"secure":1,"bidfloor":0"tagid":"/19968336/header-bid-tag-1"},{"id":"40a333e047a9bd","banner":{"w":300,"h":250},"format":[{"w":300,"h":250}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-2"}],"cur":"JPY","site":{"id":"uni-corn.net","publisher":{"id":12345},"domain":"uni-corn.net","page":"https://uni-corn.net/","ref":"https://uni-corn.net/"},"device":{"language":"ja","ua":"Mozilla/5.0 (Linux; Android 8.0.0; ONEPLUS A5000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36"},"user":{"id":"69d9e1c2-801e-4901-a665-fad467550fec"},"bcat":[],"source":{"ext":{"stype":"prebid_uncn","bidder":"unicorn","prebid_version":"1.0"}}}'
447
+ data: '{"id":"5ebea288-f13a-4754-be6d-4ade66c68877","at":1,"imp":[{"id":"216255f234b602","banner":{"w":300,"h":250},"format":[{"w":300,"h":250},{"w":336,"h":280}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-0"},{"id":"31e2b28ced2475","banner":{"w":"300","h":"250"},"format":[{"w":"300","h":"250"}],"secure":1,"bidfloor":0"tagid":"/19968336/header-bid-tag-1"},{"id":"40a333e047a9bd","banner":{"w":300,"h":250},"format":[{"w":300,"h":250}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-2"}],"cur":"JPY","site":{"id":"uni-corn.net","publisher":{"id":12345},"domain":"uni-corn.net","page":"https://uni-corn.net/","ref":"https://uni-corn.net/"},"device":{"language":"ja","ua":"Mozilla/5.0 (Linux; Android 8.0.0; ONEPLUS A5000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36"},"user":{"id":"69d9e1c2-801e-4901-a665-fad467550fec"},"bcat":[],"source":{"ext":{"stype":"prebid_uncn","bidder":"unicorn","prebid_version":"1.1"}}}'
448
448
  };
449
449
 
450
450
  const interpretedBids = [
@@ -44,7 +44,8 @@ describe('VisxAdapter', function () {
44
44
  videoBid.mediaTypes = {
45
45
  video: {
46
46
  context: 'instream',
47
- playerSize: [[400, 300]]
47
+ mimes: ['video/mp4'],
48
+ protocols: [3, 6]
48
49
  }
49
50
  };
50
51
  expect(spec.isBidRequestValid(videoBid)).to.equal(false);
@@ -55,9 +56,7 @@ describe('VisxAdapter', function () {
55
56
  videoBid.mediaTypes = {
56
57
  video: {
57
58
  context: 'instream',
58
- playerSize: [[400, 300]],
59
- mimes: ['video/mp4'],
60
- protocols: [3, 6]
59
+ playerSize: [[400, 300]]
61
60
  }
62
61
  };
63
62
  expect(spec.isBidRequestValid(videoBid)).to.equal(true);
@@ -1153,4 +1152,49 @@ describe('VisxAdapter', function () {
1153
1152
  expect(utils.triggerPixel.calledOnceWith('https://t.visx.net/track/bid_timeout?data=' + JSON.stringify(data))).to.equal(true);
1154
1153
  });
1155
1154
  });
1155
+
1156
+ describe('user sync', function () {
1157
+ function parseUrl(url) {
1158
+ const [, path, querySt] = url.match(/^https?:\/\/[^\/]+(?:\/([^?]+)?)?(?:\?(.+)?)?$/) || [];
1159
+ const query = {};
1160
+ (querySt || '').split('&').forEach((q) => {
1161
+ var kv = q.split('=');
1162
+ if (kv[0]) {
1163
+ query[kv[0]] = decodeURIComponent(kv[1] || '');
1164
+ }
1165
+ });
1166
+ return { path, query };
1167
+ }
1168
+ it('should call iframe', function () {
1169
+ let syncs = spec.getUserSyncs({
1170
+ iframeEnabled: true
1171
+ });
1172
+
1173
+ expect(Array.isArray(syncs)).to.equal(true);
1174
+ expect(syncs.length).to.equal(1);
1175
+ expect(syncs[0]).to.have.property('type', 'iframe');
1176
+ expect(syncs[0]).to.have.property('url');
1177
+ expect(syncs[0].url).to.be.an('string');
1178
+
1179
+ const { path, query } = parseUrl(syncs[0].url);
1180
+ expect(path).to.equal('push_sync');
1181
+ expect(query).to.deep.equal({iframe: '1'});
1182
+ });
1183
+
1184
+ it('should call image', function () {
1185
+ let syncs = spec.getUserSyncs({
1186
+ pixelEnabled: true
1187
+ });
1188
+
1189
+ expect(Array.isArray(syncs)).to.equal(true);
1190
+ expect(syncs.length).to.equal(1);
1191
+ expect(syncs[0]).to.have.property('type', 'image');
1192
+ expect(syncs[0]).to.have.property('url');
1193
+ expect(syncs[0].url).to.be.an('string');
1194
+
1195
+ const { path, query } = parseUrl(syncs[0].url);
1196
+ expect(path).to.equal('push_sync');
1197
+ expect(query).to.deep.equal({});
1198
+ });
1199
+ });
1156
1200
  });