prebid.js 7.32.0 → 7.33.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 (130) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adtrgtmeBidAdapter.js +1 -1
  8. package/dist/adxcgBidAdapter.js +1 -1
  9. package/dist/ajaBidAdapter.js +1 -1
  10. package/dist/amxBidAdapter.js +1 -1
  11. package/dist/amxIdSystem.js +1 -1
  12. package/dist/appierAnalyticsAdapter.js +1 -1
  13. package/dist/appnexusBidAdapter.js +1 -1
  14. package/dist/asoBidAdapter.js +1 -1
  15. package/dist/axonixBidAdapter.js +1 -1
  16. package/dist/bidglassBidAdapter.js +1 -1
  17. package/dist/big-richmediaBidAdapter.js +1 -1
  18. package/dist/bridgewellBidAdapter.js +1 -1
  19. package/dist/brightMountainMediaBidAdapter.js +1 -1
  20. package/dist/carodaBidAdapter.js +1 -1
  21. package/dist/chtnwBidAdapter.js +1 -1
  22. package/dist/concertBidAdapter.js +1 -1
  23. package/dist/connectadBidAdapter.js +1 -1
  24. package/dist/consentManagementUsp.js +1 -1
  25. package/dist/consumableBidAdapter.js +1 -1
  26. package/dist/conversantBidAdapter.js +1 -1
  27. package/dist/craftBidAdapter.js +1 -1
  28. package/dist/criteoBidAdapter.js +1 -1
  29. package/dist/dspxBidAdapter.js +1 -1
  30. package/dist/eplanningBidAdapter.js +1 -1
  31. package/dist/feedadBidAdapter.js +1 -1
  32. package/dist/finativeBidAdapter.js +1 -1
  33. package/dist/glimpseBidAdapter.js +1 -1
  34. package/dist/gmosspBidAdapter.js +1 -1
  35. package/dist/goldbachBidAdapter.js +1 -1
  36. package/dist/gridBidAdapter.js +1 -1
  37. package/dist/gridNMBidAdapter.js +1 -1
  38. package/dist/gumgumBidAdapter.js +1 -1
  39. package/dist/h12mediaBidAdapter.js +1 -1
  40. package/dist/id5IdSystem.js +1 -1
  41. package/dist/improvedigitalBidAdapter.js +1 -1
  42. package/dist/inmarBidAdapter.js +1 -1
  43. package/dist/insticatorBidAdapter.js +1 -1
  44. package/dist/ixBidAdapter.js +1 -1
  45. package/dist/justpremiumBidAdapter.js +1 -1
  46. package/dist/konduitAnalyticsAdapter.js +1 -1
  47. package/dist/kueezBidAdapter.js +1 -1
  48. package/dist/kueezRtbBidAdapter.js +1 -1
  49. package/dist/lassoBidAdapter.js +1 -1
  50. package/dist/lifestreetBidAdapter.js +1 -1
  51. package/dist/liveIntentIdSystem.js +1 -1
  52. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  53. package/dist/logicadBidAdapter.js +1 -1
  54. package/dist/loglyliftBidAdapter.js +1 -1
  55. package/dist/magniteAnalyticsAdapter.js +1 -1
  56. package/dist/malltvAnalyticsAdapter.js +1 -1
  57. package/dist/marsmediaBidAdapter.js +1 -1
  58. package/dist/mediafuseBidAdapter.js +1 -1
  59. package/dist/mediasquareBidAdapter.js +1 -1
  60. package/dist/mgidBidAdapter.js +1 -1
  61. package/dist/minutemediaBidAdapter.js +1 -1
  62. package/dist/nexx360BidAdapter.js +1 -1
  63. package/dist/not-for-prod/prebid.js +116 -116
  64. package/dist/oguryBidAdapter.js +1 -1
  65. package/dist/onetagBidAdapter.js +1 -1
  66. package/dist/ooloAnalyticsAdapter.js +1 -1
  67. package/dist/outbrainBidAdapter.js +1 -1
  68. package/dist/parrableIdSystem.js +1 -1
  69. package/dist/pixfutureBidAdapter.js +1 -1
  70. package/dist/prebid-core.js +1 -1
  71. package/dist/priceFloors.js +1 -1
  72. package/dist/publinkIdSystem.js +1 -1
  73. package/dist/pubmaticBidAdapter.js +1 -1
  74. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  75. package/dist/pxyzBidAdapter.js +1 -1
  76. package/dist/quantcastBidAdapter.js +1 -1
  77. package/dist/readpeakBidAdapter.js +1 -1
  78. package/dist/relaidoBidAdapter.js +1 -1
  79. package/dist/rhythmoneBidAdapter.js +1 -1
  80. package/dist/riseBidAdapter.js +1 -1
  81. package/dist/rubiconAnalyticsAdapter.js +1 -1
  82. package/dist/rubiconBidAdapter.js +1 -1
  83. package/dist/seedingAllianceBidAdapter.js +1 -1
  84. package/dist/seedtagBidAdapter.js +1 -1
  85. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  86. package/dist/sharethroughBidAdapter.js +1 -1
  87. package/dist/shinezBidAdapter.js +1 -1
  88. package/dist/smaatoBidAdapter.js +1 -1
  89. package/dist/smartadserverBidAdapter.js +1 -1
  90. package/dist/smartxBidAdapter.js +1 -1
  91. package/dist/smilewantedBidAdapter.js +1 -1
  92. package/dist/sonobiBidAdapter.js +1 -1
  93. package/dist/sovrnAnalyticsAdapter.js +1 -1
  94. package/dist/sovrnBidAdapter.js +1 -1
  95. package/dist/sspBCBidAdapter.js +1 -1
  96. package/dist/sublimeBidAdapter.js +1 -1
  97. package/dist/synacormediaBidAdapter.js +1 -1
  98. package/dist/targetVideoBidAdapter.js +1 -1
  99. package/dist/teadsBidAdapter.js +1 -1
  100. package/dist/trionBidAdapter.js +1 -1
  101. package/dist/tripleliftBidAdapter.js +1 -1
  102. package/dist/ttdBidAdapter.js +1 -1
  103. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  104. package/dist/uid2IdSystem.js +1 -1
  105. package/dist/underdogmediaBidAdapter.js +1 -1
  106. package/dist/undertoneBidAdapter.js +1 -1
  107. package/dist/vidazooBidAdapter.js +1 -1
  108. package/dist/videobyteBidAdapter.js +1 -1
  109. package/dist/visxBidAdapter.js +1 -1
  110. package/dist/vuukleBidAdapter.js +1 -1
  111. package/dist/widespaceBidAdapter.js +1 -1
  112. package/dist/winrBidAdapter.js +1 -1
  113. package/dist/yahoosspBidAdapter.js +1 -1
  114. package/dist/yieldmoBidAdapter.js +1 -1
  115. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  116. package/modules/consentManagementUsp.js +10 -10
  117. package/modules/criteoBidAdapter.js +1 -1
  118. package/modules/id5IdSystem.js +3 -1
  119. package/modules/ixBidAdapter.js +25 -6
  120. package/modules/nexx360BidAdapter.js +2 -1
  121. package/modules/priceFloors.js +11 -5
  122. package/modules/seedtagBidAdapter.js +20 -6
  123. package/modules/targetVideoBidAdapter.js +1 -1
  124. package/package.json +2 -2
  125. package/src/utils/promise.js +8 -0
  126. package/test/spec/modules/consentManagementUsp_spec.js +15 -2
  127. package/test/spec/modules/ixBidAdapter_spec.js +117 -6
  128. package/test/spec/modules/priceFloors_spec.js +155 -0
  129. package/test/spec/modules/seedtagBidAdapter_spec.js +58 -17
  130. package/test/spec/modules/targetVideoBidAdapter_spec.js +2 -2
@@ -658,7 +658,7 @@ describe('IndexexchangeAdapter', function () {
658
658
  }
659
659
  };
660
660
 
661
- const DEFAULT_VIDEO_BID_RESPONSE_WITH_MTYPE_SET = {
661
+ const DEFAULT_VIDEO_BID_RESPONSE_WITH_XML_ADM = {
662
662
  cur: 'USD',
663
663
  id: '1aa2bb3cc4de',
664
664
  seatbid: [
@@ -675,7 +675,6 @@ describe('IndexexchangeAdapter', function () {
675
675
  mtype: 2,
676
676
  adm: '<?xml version=\"1.0\" encoding=\"UTF-8\"?><VAST xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"vast.xsd\" version=\"3.0\"> <Ad id=\"488427365\"> <InLine> <AdSystem>Test</AdSystem> <AdTitle>In-Stream Video</AdTitle> </InLine> </Ad></VAST',
677
677
  ext: {
678
- vasturl: 'www.abcd.com/vast',
679
678
  errorurl: 'www.abcd.com/error',
680
679
  dspid: 51,
681
680
  pricelevel: '_110',
@@ -1614,15 +1613,15 @@ describe('IndexexchangeAdapter', function () {
1614
1613
  expect(r.ext.ixdiag.fpd).to.exist;
1615
1614
  });
1616
1615
 
1617
- it('should set ixdiag.tmax value if it exists using tmax', function () {
1616
+ it('should set ixdiag.tmax value from bidderRequest overriding global config bidderTimeout', function () {
1618
1617
  config.setConfig({
1619
1618
  bidderTimeout: 250
1620
1619
  });
1621
1620
 
1622
- const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID)[0];
1621
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { timeout: 1234 })[0];
1623
1622
  const r = extractPayload(request);
1624
1623
 
1625
- expect(r.ext.ixdiag.tmax).to.equal(250);
1624
+ expect(r.ext.ixdiag.tmax).to.equal(1234);
1626
1625
  });
1627
1626
 
1628
1627
  it('should not set ixdiag.tmax value if bidderTimeout is undefined', function () {
@@ -1686,6 +1685,40 @@ describe('IndexexchangeAdapter', function () {
1686
1685
  expect(r.site.keywords).to.be.undefined;
1687
1686
  expect(r.user).to.be.undefined;
1688
1687
  });
1688
+ it('should set gpp and gpp_sid field when defined', function () {
1689
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2: {regs: {gpp: 'gpp', gpp_sid: [1]}} })[0];
1690
+ const r = extractPayload(request);
1691
+
1692
+ expect(r.regs.gpp).to.equal('gpp');
1693
+ expect(r.regs.gpp_sid).to.be.an('array');
1694
+ expect(r.regs.gpp_sid).to.include(1);
1695
+ });
1696
+ it('should not set gpp and gpp_sid field when not defined', function () {
1697
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2: {regs: {}} })[0];
1698
+ const r = extractPayload(request);
1699
+
1700
+ expect(r.regs).to.be.undefined;
1701
+ });
1702
+ it('should not set gpp and gpp_sid field when fields arent strings or array defined', function () {
1703
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2: {regs: {gpp: 1, gpp_sid: 'string'}} })[0];
1704
+ const r = extractPayload(request);
1705
+
1706
+ expect(r.regs).to.be.undefined;
1707
+ });
1708
+ it('should set gpp info from module when it exists', function () {
1709
+ const options = {
1710
+ gppConsent: {
1711
+ gppString: 'gpp',
1712
+ applicableSections: [1]
1713
+ }
1714
+ };
1715
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
1716
+ const r = extractPayload(request[0]);
1717
+
1718
+ expect(r.regs.gpp).to.equal('gpp');
1719
+ expect(r.regs.gpp_sid).to.be.an('array');
1720
+ expect(r.regs.gpp_sid).to.include(1);
1721
+ });
1689
1722
  });
1690
1723
 
1691
1724
  describe('buildRequests', function () {
@@ -2065,6 +2098,44 @@ describe('IndexexchangeAdapter', function () {
2065
2098
  expect(pageUrl).to.equal(expectedPageUrl);
2066
2099
  });
2067
2100
 
2101
+ it('should set device sua if available in fpd and request size does not exceed limit', function () {
2102
+ const ortb2 = {
2103
+ device: {
2104
+ sua: {
2105
+ platform: {
2106
+ brand: 'macOS',
2107
+ version: [ '12', '6', '1' ]
2108
+ },
2109
+ browsers: [
2110
+ {
2111
+ brand: 'Chromium',
2112
+ version: [ '107', '0', '5249', '119' ]
2113
+ },
2114
+ {
2115
+ brand: 'Google Chrome',
2116
+ version: [ '107', '0', '5249', '119' ]
2117
+ },
2118
+ ],
2119
+ mobile: 0,
2120
+ model: ''
2121
+ }
2122
+ }};
2123
+
2124
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2 })[0];
2125
+ const payload = extractPayload(request);
2126
+ expect(payload.device.sua.platform.brand).to.equal('macOS')
2127
+ expect(payload.device.sua.mobile).to.equal(0)
2128
+ });
2129
+
2130
+ it('should not set device sua if not available in fpd', function () {
2131
+ const ortb2 = {
2132
+ device: {}};
2133
+
2134
+ const request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, { ortb2 })[0];
2135
+ const payload = extractPayload(request);
2136
+ expect(payload.device).to.be.undefined
2137
+ });
2138
+
2068
2139
  it('should not set first party data if it is not an object', function () {
2069
2140
  config.setConfig({
2070
2141
  ix: {
@@ -3121,13 +3192,53 @@ describe('IndexexchangeAdapter', function () {
3121
3192
  }
3122
3193
  }
3123
3194
  ];
3124
- const result = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE_WITH_MTYPE_SET }, {
3195
+ const result = spec.interpretResponse({ body: DEFAULT_VIDEO_BID_RESPONSE_WITH_XML_ADM }, {
3125
3196
  data: videoBidderRequest.data, validBidRequests: ONE_VIDEO
3126
3197
  });
3127
3198
 
3128
3199
  expect(result[0]).to.deep.equal(expectedParse[0]);
3129
3200
  });
3130
3201
 
3202
+ it('should not set vastxml when vasturl is present and when mtype is 2 (video)', function () {
3203
+ const expectedParse = [
3204
+ {
3205
+ requestId: '1a2b3c4e',
3206
+ cpm: 1.1,
3207
+ creativeId: '12346',
3208
+ mediaType: 'video',
3209
+ mediaTypes: {
3210
+ video: {
3211
+ context: 'instream',
3212
+ playerSize: [
3213
+ [
3214
+ 400,
3215
+ 100
3216
+ ]
3217
+ ]
3218
+ }
3219
+ },
3220
+ width: 640,
3221
+ height: 480,
3222
+ currency: 'USD',
3223
+ ttl: 3600,
3224
+ netRevenue: true,
3225
+ vastUrl: 'www.abcd.com/vast',
3226
+ meta: {
3227
+ networkId: 51,
3228
+ brandId: 303326,
3229
+ brandName: 'OECTB',
3230
+ advertiserDomains: ['www.abcd.com']
3231
+ }
3232
+ }
3233
+ ];
3234
+ let bid_response = DEFAULT_VIDEO_BID_RESPONSE_WITH_XML_ADM;
3235
+ bid_response.seatbid[0].bid[0].ext['vasturl'] = 'www.abcd.com/vast';
3236
+ const result = spec.interpretResponse({ body: bid_response }, {
3237
+ data: videoBidderRequest.data, validBidRequests: ONE_VIDEO
3238
+ });
3239
+ expect(result[0]).to.deep.equal(expectedParse[0]);
3240
+ });
3241
+
3131
3242
  it('bidrequest should not have page if options is undefined', function () {
3132
3243
  const options = {};
3133
3244
  const validBidWithoutreferInfo = spec.buildRequests(DEFAULT_BANNER_VALID_BID, options);
@@ -1495,6 +1495,161 @@ describe('the price floors module', function () {
1495
1495
  });
1496
1496
  });
1497
1497
 
1498
+ it('should use inverseFloorAdjustment function before bidder cpm adjustment', function () {
1499
+ let functionUsed;
1500
+ getGlobal().bidderSettings = {
1501
+ rubicon: {
1502
+ bidCpmAdjustment: function (bidCpm, bidResponse) {
1503
+ functionUsed = 'Rubicon Adjustment';
1504
+ bidCpm *= 0.5;
1505
+ if (bidResponse.mediaType === 'video') bidCpm -= 0.18;
1506
+ return bidCpm;
1507
+ },
1508
+ inverseBidAdjustment: function (bidCpm, bidRequest) {
1509
+ functionUsed = 'Rubicon Inverse';
1510
+ // if video is the only mediaType on Bid Request => add 0.18
1511
+ if (bidRequest.mediaTypes.video && Object.keys(bidRequest.mediaTypes).length === 1) bidCpm += 0.18;
1512
+ return bidCpm / 0.5;
1513
+ },
1514
+ },
1515
+ appnexus: {
1516
+ bidCpmAdjustment: function (bidCpm, bidResponse) {
1517
+ functionUsed = 'Appnexus Adjustment';
1518
+ bidCpm *= 0.75;
1519
+ if (bidResponse.mediaType === 'video') bidCpm -= 0.18;
1520
+ return bidCpm;
1521
+ },
1522
+ inverseBidAdjustment: function (bidCpm, bidRequest) {
1523
+ functionUsed = 'Appnexus Inverse';
1524
+ // if video is the only mediaType on Bid Request => add 0.18
1525
+ if (bidRequest.mediaTypes.video && Object.keys(bidRequest.mediaTypes).length === 1) bidCpm += 0.18;
1526
+ return bidCpm / 0.75;
1527
+ },
1528
+ }
1529
+ };
1530
+
1531
+ _floorDataForAuction[bidRequest.auctionId] = utils.deepClone(basicFloorConfig);
1532
+
1533
+ _floorDataForAuction[bidRequest.auctionId].data.values = { '*': 1.0 };
1534
+
1535
+ // start with banner as only mediaType
1536
+ bidRequest.mediaTypes = { banner: { sizes: [[300, 250]] } };
1537
+ let appnexusBid = {
1538
+ ...bidRequest,
1539
+ bidder: 'appnexus',
1540
+ };
1541
+
1542
+ // should be same as the adjusted calculated inverses above test (banner)
1543
+ expect(bidRequest.getFloor()).to.deep.equal({
1544
+ currency: 'USD',
1545
+ floor: 2.0
1546
+ });
1547
+
1548
+ // should use rubicon inverse
1549
+ expect(functionUsed).to.equal('Rubicon Inverse');
1550
+
1551
+ // appnexus just using banner should be same
1552
+ expect(appnexusBid.getFloor()).to.deep.equal({
1553
+ currency: 'USD',
1554
+ floor: 1.3334
1555
+ });
1556
+
1557
+ expect(functionUsed).to.equal('Appnexus Inverse');
1558
+
1559
+ // now since asking for 'video' only mediaType inverse function should include the .18
1560
+ bidRequest.mediaTypes = { video: { context: 'instream' } };
1561
+ expect(bidRequest.getFloor({ mediaType: 'video' })).to.deep.equal({
1562
+ currency: 'USD',
1563
+ floor: 2.36
1564
+ });
1565
+
1566
+ expect(functionUsed).to.equal('Rubicon Inverse');
1567
+
1568
+ // now since asking for 'video' inverse function should include the .18
1569
+ appnexusBid.mediaTypes = { video: { context: 'instream' } };
1570
+ expect(appnexusBid.getFloor({ mediaType: 'video' })).to.deep.equal({
1571
+ currency: 'USD',
1572
+ floor: 1.5734
1573
+ });
1574
+
1575
+ expect(functionUsed).to.equal('Appnexus Inverse');
1576
+ });
1577
+
1578
+ it('should pass inverseFloorAdjustment the bidRequest object so it can be used', function () {
1579
+ // Adjustment factors based on Bid Media Type
1580
+ const mediaTypeFactors = {
1581
+ banner: 0.5,
1582
+ native: 0.7,
1583
+ video: 0.9
1584
+ }
1585
+ getGlobal().bidderSettings = {
1586
+ rubicon: {
1587
+ bidCpmAdjustment: function (bidCpm, bidResponse) {
1588
+ return bidCpm * mediaTypeFactors[bidResponse.mediaType];
1589
+ },
1590
+ inverseBidAdjustment: function (bidCpm, bidRequest) {
1591
+ // For the inverse we add up each mediaType in the request and divide by number of Mt's to get the inverse number
1592
+ let factor = Object.keys(bidRequest.mediaTypes).reduce((sum, mediaType) => sum += mediaTypeFactors[mediaType], 0);
1593
+ factor = factor / Object.keys(bidRequest.mediaTypes).length;
1594
+ return bidCpm / factor;
1595
+ },
1596
+ }
1597
+ };
1598
+
1599
+ _floorDataForAuction[bidRequest.auctionId] = utils.deepClone(basicFloorConfig);
1600
+
1601
+ _floorDataForAuction[bidRequest.auctionId].data.values = { '*': 1.0 };
1602
+
1603
+ // banner only should be 2
1604
+ bidRequest.mediaTypes = { banner: {} };
1605
+ expect(bidRequest.getFloor()).to.deep.equal({
1606
+ currency: 'USD',
1607
+ floor: 2.0
1608
+ });
1609
+
1610
+ // native only should be 1.4286
1611
+ bidRequest.mediaTypes = { native: {} };
1612
+ expect(bidRequest.getFloor()).to.deep.equal({
1613
+ currency: 'USD',
1614
+ floor: 1.4286
1615
+ });
1616
+
1617
+ // video only should be 1.1112
1618
+ bidRequest.mediaTypes = { video: {} };
1619
+ expect(bidRequest.getFloor()).to.deep.equal({
1620
+ currency: 'USD',
1621
+ floor: 1.1112
1622
+ });
1623
+
1624
+ // video and banner should even out to 0.7 factor so 1.4286
1625
+ bidRequest.mediaTypes = { video: {}, banner: {} };
1626
+ expect(bidRequest.getFloor()).to.deep.equal({
1627
+ currency: 'USD',
1628
+ floor: 1.4286
1629
+ });
1630
+
1631
+ // video and native should even out to 0.8 factor so -- 1.25
1632
+ bidRequest.mediaTypes = { video: {}, native: {} };
1633
+ expect(bidRequest.getFloor()).to.deep.equal({
1634
+ currency: 'USD',
1635
+ floor: 1.25
1636
+ });
1637
+
1638
+ // banner and native should even out to 0.6 factor so -- 1.6667
1639
+ bidRequest.mediaTypes = { banner: {}, native: {} };
1640
+ expect(bidRequest.getFloor()).to.deep.equal({
1641
+ currency: 'USD',
1642
+ floor: 1.6667
1643
+ });
1644
+
1645
+ // all 3 banner video and native should even out to 0.7 factor so -- 1.4286
1646
+ bidRequest.mediaTypes = { banner: {}, native: {}, video: {} };
1647
+ expect(bidRequest.getFloor()).to.deep.equal({
1648
+ currency: 'USD',
1649
+ floor: 1.4286
1650
+ });
1651
+ });
1652
+
1498
1653
  it('should use standard cpmAdjustment if no bidder cpmAdjustment', function () {
1499
1654
  getGlobal().bidderSettings = {
1500
1655
  rubicon: {
@@ -33,30 +33,60 @@ function createInStreamSlotConfig(mediaType) {
33
33
  });
34
34
  }
35
35
 
36
+ const createBannerSlotConfig = (placement, mediatypes) => {
37
+ return getSlotConfigs(mediatypes || { banner: {} }, {
38
+ publisherId: PUBLISHER_ID,
39
+ adUnitId: ADUNIT_ID,
40
+ placement,
41
+ });
42
+ };
43
+
36
44
  describe('Seedtag Adapter', function () {
37
45
  describe('isBidRequestValid method', function () {
38
46
  describe('returns true', function () {
39
47
  describe('when banner slot config has all mandatory params', () => {
40
- describe('and placement has the correct value', function () {
41
- const createBannerSlotConfig = (placement) => {
42
- return getSlotConfigs(
43
- { banner: {} },
44
- {
45
- publisherId: PUBLISHER_ID,
46
- adUnitId: ADUNIT_ID,
47
- placement,
48
- }
48
+ const placements = ['inBanner', 'inImage', 'inScreen', 'inArticle'];
49
+ placements.forEach((placement) => {
50
+ it(placement + 'should be valid', function () {
51
+ const isBidRequestValid = spec.isBidRequestValid(
52
+ createBannerSlotConfig(placement)
49
53
  );
50
- };
51
- const placements = ['inBanner', 'inImage', 'inScreen', 'inArticle'];
52
- placements.forEach((placement) => {
53
- it('should be ' + placement, function () {
54
+ expect(isBidRequestValid).to.equal(true);
55
+ });
56
+
57
+ it(
58
+ placement +
59
+ ' should be valid when has display and video mediatypes, and video context is outstream',
60
+ function () {
54
61
  const isBidRequestValid = spec.isBidRequestValid(
55
- createBannerSlotConfig(placement)
62
+ createBannerSlotConfig(placement, {
63
+ banner: {},
64
+ video: {
65
+ context: 'outstream',
66
+ playerSize: [[600, 200]],
67
+ },
68
+ })
56
69
  );
57
70
  expect(isBidRequestValid).to.equal(true);
58
- });
59
- });
71
+ }
72
+ );
73
+
74
+ it(
75
+ placement +
76
+ " shouldn't be valid when has display and video mediatypes, and video context is instream",
77
+ function () {
78
+ const isBidRequestValid = spec.isBidRequestValid(
79
+ createBannerSlotConfig(placement, {
80
+ banner: {},
81
+ video: {
82
+ context: 'instream',
83
+ playerSize: [[600, 200]],
84
+ },
85
+ })
86
+ );
87
+ expect(isBidRequestValid).to.equal(false);
88
+ }
89
+ );
60
90
  });
61
91
  });
62
92
  describe('when video slot has all mandatory params', function () {
@@ -70,7 +100,18 @@ describe('Seedtag Adapter', function () {
70
100
  const isBidRequestValid = spec.isBidRequestValid(slotConfig);
71
101
  expect(isBidRequestValid).to.equal(true);
72
102
  });
73
- it('should return true, when video context is instream, but placement is not inStream', function () {
103
+ it('should return true, when video context is instream and mediatype is video and banner', function () {
104
+ const slotConfig = createInStreamSlotConfig({
105
+ video: {
106
+ context: 'instream',
107
+ playerSize: [[600, 200]],
108
+ },
109
+ banner: {},
110
+ });
111
+ const isBidRequestValid = spec.isBidRequestValid(slotConfig);
112
+ expect(isBidRequestValid).to.equal(true);
113
+ });
114
+ it('should return false, when video context is instream, but placement is not inStream', function () {
74
115
  const slotConfig = getSlotConfigs(
75
116
  {
76
117
  video: {
@@ -58,7 +58,7 @@ describe('TargetVideo Bid Adapter', function() {
58
58
  'uuid': '84ab500420319d',
59
59
  'ads': [{
60
60
  'ad_type': 'video',
61
- 'cpm': 0.500000,
61
+ 'cpm': 0.675000,
62
62
  'notify_url': 'https://www.target-video.com/',
63
63
  'rtb': {
64
64
  'video': {
@@ -87,7 +87,7 @@ describe('TargetVideo Bid Adapter', function() {
87
87
 
88
88
  const bid = bidResponse[0];
89
89
  expect(bid).to.not.be.empty;
90
- expect(bid.cpm).to.equal(0.675);
90
+ expect(bid.cpm).to.equal(0.5);
91
91
  expect(bid.width).to.equal(300);
92
92
  expect(bid.height).to.equal(250);
93
93
  expect(bid.ad).to.include('<script src="https://player.target-video.com/custom/targetvideo-banner.js"></script>')