prebid.js 7.44.0 → 7.46.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 (309) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/acuityAdsBidAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/admaticBidAdapter.js +1 -1
  8. package/dist/adnuntiusBidAdapter.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adtrgtmeBidAdapter.js +1 -1
  11. package/dist/adxcgBidAdapter.js +1 -1
  12. package/dist/adyoulikeBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/appushBidAdapter.js +1 -1
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/beyondmediaBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/braveBidAdapter.js +1 -1
  26. package/dist/bridgewellBidAdapter.js +1 -1
  27. package/dist/brightMountainMediaBidAdapter.js +1 -1
  28. package/dist/brightcomBidAdapter.js +1 -1
  29. package/dist/brightcomSSPBidAdapter.js +1 -1
  30. package/dist/carodaBidAdapter.js +1 -1
  31. package/dist/chtnwBidAdapter.js +1 -1
  32. package/dist/coinzillaBidAdapter.js +1 -1
  33. package/dist/compassBidAdapter.js +1 -1
  34. package/dist/concertBidAdapter.js +1 -1
  35. package/dist/connectIdSystem.js +1 -1
  36. package/dist/connectadBidAdapter.js +1 -1
  37. package/dist/consumableBidAdapter.js +1 -1
  38. package/dist/contentexchangeBidAdapter.js +1 -1
  39. package/dist/conversantAnalyticsAdapter.js +1 -1
  40. package/dist/conversantBidAdapter.js +1 -1
  41. package/dist/craftBidAdapter.js +1 -1
  42. package/dist/criteoBidAdapter.js +1 -1
  43. package/dist/cwireBidAdapter.js +1 -1
  44. package/dist/debugging-standalone.js +1 -1
  45. package/dist/dependencies.json +15 -0
  46. package/dist/domainOverrideToRootDomain.js +1 -0
  47. package/dist/dspxBidAdapter.js +1 -1
  48. package/dist/eplanningBidAdapter.js +1 -1
  49. package/dist/eskimiBidAdapter.js +1 -0
  50. package/dist/feedadBidAdapter.js +1 -1
  51. package/dist/finativeBidAdapter.js +1 -1
  52. package/dist/freewheel-sspBidAdapter.js +1 -1
  53. package/dist/glimpseBidAdapter.js +1 -1
  54. package/dist/globalsunBidAdapter.js +1 -1
  55. package/dist/gmosspBidAdapter.js +1 -1
  56. package/dist/goldbachBidAdapter.js +1 -1
  57. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  58. package/dist/gridBidAdapter.js +1 -1
  59. package/dist/growthCodeIdSystem.js +1 -1
  60. package/dist/gumgumBidAdapter.js +1 -1
  61. package/dist/h12mediaBidAdapter.js +1 -1
  62. package/dist/id5IdSystem.js +1 -1
  63. package/dist/improvedigitalBidAdapter.js +1 -1
  64. package/dist/inmarBidAdapter.js +1 -1
  65. package/dist/insticatorBidAdapter.js +1 -1
  66. package/dist/iqzoneBidAdapter.js +1 -1
  67. package/dist/ivsBidAdapter.js +1 -0
  68. package/dist/ixBidAdapter.js +1 -1
  69. package/dist/justpremiumBidAdapter.js +1 -1
  70. package/dist/jwplayerVideoProvider.js +1 -1
  71. package/dist/kargoBidAdapter.js +1 -1
  72. package/dist/koblerBidAdapter.js +1 -1
  73. package/dist/konduitAnalyticsAdapter.js +1 -1
  74. package/dist/kueezBidAdapter.js +1 -1
  75. package/dist/kueezRtbBidAdapter.js +1 -1
  76. package/dist/kulturemediaBidAdapter.js +1 -1
  77. package/dist/lassoBidAdapter.js +1 -1
  78. package/dist/lifestreetBidAdapter.js +1 -1
  79. package/dist/liveIntentIdSystem.js +1 -1
  80. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  81. package/dist/logicadBidAdapter.js +1 -1
  82. package/dist/loglyliftBidAdapter.js +1 -1
  83. package/dist/luponmediaBidAdapter.js +1 -1
  84. package/dist/magniteAnalyticsAdapter.js +1 -1
  85. package/dist/malltvAnalyticsAdapter.js +1 -1
  86. package/dist/marsmediaBidAdapter.js +1 -1
  87. package/dist/mathildeadsBidAdapter.js +1 -1
  88. package/dist/mediafuseBidAdapter.js +1 -1
  89. package/dist/medianetBidAdapter.js +1 -1
  90. package/dist/mediasquareBidAdapter.js +1 -1
  91. package/dist/mgidBidAdapter.js +1 -1
  92. package/dist/minutemediaBidAdapter.js +1 -1
  93. package/dist/minutemediaplusBidAdapter.js +1 -1
  94. package/dist/nativoBidAdapter.js +1 -1
  95. package/dist/neuwoRtdProvider.js +1 -1
  96. package/dist/nexx360BidAdapter.js +1 -1
  97. package/dist/not-for-prod/prebid.js +165 -162
  98. package/dist/oguryBidAdapter.js +1 -1
  99. package/dist/onetagBidAdapter.js +1 -1
  100. package/dist/onomagicBidAdapter.js +1 -1
  101. package/dist/ooloAnalyticsAdapter.js +1 -1
  102. package/dist/openxBidAdapter.js +1 -1
  103. package/dist/openxOrtbBidAdapter.js +1 -1
  104. package/dist/operaadsBidAdapter.js +1 -1
  105. package/dist/optidigitalBidAdapter.js +1 -1
  106. package/dist/ortbConverter.js +1 -1
  107. package/dist/outbrainBidAdapter.js +1 -1
  108. package/dist/pairIdSystem.js +1 -0
  109. package/dist/parrableIdSystem.js +1 -1
  110. package/dist/pixfutureBidAdapter.js +1 -1
  111. package/dist/prebid-core.js +1 -1
  112. package/dist/publinkIdSystem.js +1 -1
  113. package/dist/pubmaticBidAdapter.js +1 -1
  114. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  115. package/dist/pubxBidAdapter.js +1 -1
  116. package/dist/pxyzBidAdapter.js +1 -1
  117. package/dist/quantcastBidAdapter.js +1 -1
  118. package/dist/readpeakBidAdapter.js +1 -1
  119. package/dist/relaidoBidAdapter.js +1 -1
  120. package/dist/rhythmoneBidAdapter.js +1 -1
  121. package/dist/riseBidAdapter.js +1 -1
  122. package/dist/rubiconAnalyticsAdapter.js +1 -1
  123. package/dist/rubiconBidAdapter.js +1 -1
  124. package/dist/seedingAllianceBidAdapter.js +1 -1
  125. package/dist/seedtagBidAdapter.js +1 -1
  126. package/dist/sharedIdSystem.js +1 -1
  127. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  128. package/dist/sharethroughBidAdapter.js +1 -1
  129. package/dist/shinezBidAdapter.js +1 -1
  130. package/dist/smaatoBidAdapter.js +1 -1
  131. package/dist/smartadserverBidAdapter.js +1 -1
  132. package/dist/smarthubBidAdapter.js +1 -1
  133. package/dist/smartxBidAdapter.js +1 -1
  134. package/dist/smilewantedBidAdapter.js +1 -1
  135. package/dist/sonobiBidAdapter.js +1 -1
  136. package/dist/sovrnAnalyticsAdapter.js +1 -1
  137. package/dist/sovrnBidAdapter.js +1 -1
  138. package/dist/sspBCBidAdapter.js +1 -1
  139. package/dist/stvBidAdapter.js +1 -1
  140. package/dist/sublimeBidAdapter.js +1 -1
  141. package/dist/synacormediaBidAdapter.js +1 -1
  142. package/dist/targetVideoBidAdapter.js +1 -1
  143. package/dist/teadsBidAdapter.js +1 -1
  144. package/dist/trionBidAdapter.js +1 -1
  145. package/dist/tripleliftBidAdapter.js +1 -1
  146. package/dist/truereachBidAdapter.js +1 -1
  147. package/dist/ttdBidAdapter.js +1 -1
  148. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  149. package/dist/uid2IdSystem.js +1 -1
  150. package/dist/underdogmediaBidAdapter.js +1 -1
  151. package/dist/undertoneBidAdapter.js +1 -1
  152. package/dist/userId.js +1 -1
  153. package/dist/vidazooBidAdapter.js +1 -1
  154. package/dist/videobyteBidAdapter.js +1 -1
  155. package/dist/videoheroesBidAdapter.js +1 -1
  156. package/dist/vidoomyBidAdapter.js +1 -1
  157. package/dist/visiblemeasuresBidAdapter.js +1 -1
  158. package/dist/visxBidAdapter.js +1 -1
  159. package/dist/vrtcalBidAdapter.js +1 -1
  160. package/dist/vuukleBidAdapter.js +1 -1
  161. package/dist/widespaceBidAdapter.js +1 -1
  162. package/dist/winrBidAdapter.js +1 -1
  163. package/dist/yahoosspBidAdapter.js +1 -1
  164. package/dist/yieldmoBidAdapter.js +1 -1
  165. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  166. package/dist/yieldoneBidAdapter.js +1 -1
  167. package/integrationExamples/gpt/fledge_example.html +103 -0
  168. package/integrationExamples/gpt/prebidServer_fledge_example.html +111 -0
  169. package/libraries/domainOverrideToRootDomain/index.js +39 -0
  170. package/libraries/ortbConverter/processors/video.js +1 -0
  171. package/modules/acuityAdsBidAdapter.js +1 -1
  172. package/modules/admaticBidAdapter.js +7 -2
  173. package/modules/adnuntiusBidAdapter.js +3 -1
  174. package/modules/amxBidAdapter.js +1 -1
  175. package/modules/amxIdSystem.js +23 -20
  176. package/modules/amxIdSystem.md +7 -7
  177. package/modules/appnexusBidAdapter.js +108 -102
  178. package/modules/appushBidAdapter.js +1 -1
  179. package/modules/beyondmediaBidAdapter.js +1 -1
  180. package/modules/bidwatchAnalyticsAdapter.js +2 -0
  181. package/modules/braveBidAdapter.js +1 -1
  182. package/modules/brightcomBidAdapter.js +1 -1
  183. package/modules/brightcomSSPBidAdapter.js +1 -1
  184. package/modules/coinzillaBidAdapter.js +1 -2
  185. package/modules/compassBidAdapter.js +1 -1
  186. package/modules/connectIdSystem.js +96 -21
  187. package/modules/connectIdSystem.md +6 -5
  188. package/modules/contentexchangeBidAdapter.js +1 -1
  189. package/modules/conversantBidAdapter.js +3 -0
  190. package/modules/criteoBidAdapter.js +5 -1
  191. package/modules/eskimiBidAdapter.js +72 -0
  192. package/modules/eskimiBidAdapter.md +34 -0
  193. package/modules/freewheel-sspBidAdapter.js +8 -0
  194. package/modules/glimpseBidAdapter.js +1 -2
  195. package/modules/globalsunBidAdapter.js +1 -1
  196. package/modules/gridBidAdapter.js +43 -20
  197. package/modules/growthCodeIdSystem.js +18 -15
  198. package/modules/gumgumBidAdapter.js +1 -1
  199. package/modules/iqzoneBidAdapter.js +1 -1
  200. package/modules/ivsBidAdapter.js +85 -0
  201. package/modules/ivsBidAdapter.md +34 -0
  202. package/modules/ixBidAdapter.js +72 -105
  203. package/modules/jwplayerVideoProvider.js +25 -32
  204. package/modules/kargoBidAdapter.js +473 -246
  205. package/modules/koblerBidAdapter.js +1 -2
  206. package/modules/kueezBidAdapter.js +1 -1
  207. package/modules/kueezRtbBidAdapter.js +16 -4
  208. package/modules/liveIntentIdSystem.js +8 -0
  209. package/modules/luponmediaBidAdapter.js +1 -1
  210. package/modules/magniteAnalyticsAdapter.js +76 -3
  211. package/modules/mathildeadsBidAdapter.js +1 -1
  212. package/modules/medianetBidAdapter.js +1 -1
  213. package/modules/mediasquareBidAdapter.js +2 -1
  214. package/modules/mgidBidAdapter.js +178 -26
  215. package/modules/minutemediaBidAdapter.js +1 -1
  216. package/modules/minutemediaplusBidAdapter.js +16 -4
  217. package/modules/nativoBidAdapter.js +110 -21
  218. package/modules/neuwoRtdProvider.js +0 -2
  219. package/modules/oguryBidAdapter.js +3 -2
  220. package/modules/onomagicBidAdapter.js +1 -2
  221. package/modules/openxBidAdapter.js +192 -563
  222. package/modules/openxBidAdapter.md +22 -20
  223. package/modules/openxOrtbBidAdapter.js +13 -11
  224. package/modules/openxOrtbBidAdapter.md +5 -3
  225. package/modules/operaadsBidAdapter.js +1 -1
  226. package/modules/pairIdSystem.js +79 -0
  227. package/modules/pubmaticBidAdapter.js +13 -10
  228. package/modules/pubxBidAdapter.js +5 -2
  229. package/modules/riseBidAdapter.js +1 -1
  230. package/modules/sharedIdSystem.js +4 -27
  231. package/modules/sharethroughBidAdapter.js +1 -1
  232. package/modules/shinezBidAdapter.js +1 -1
  233. package/modules/smarthubBidAdapter.js +1 -1
  234. package/modules/synacormediaBidAdapter.js +1 -3
  235. package/modules/truereachBidAdapter.js +1 -2
  236. package/modules/userId/eids.js +24 -0
  237. package/modules/userId/eids.md +16 -0
  238. package/modules/videoheroesBidAdapter.js +1 -1
  239. package/modules/vidoomyBidAdapter.js +33 -4
  240. package/modules/visiblemeasuresBidAdapter.js +1 -1
  241. package/modules/vrtcalBidAdapter.js +1 -1
  242. package/modules/yieldmoBidAdapter.js +15 -5
  243. package/modules/yieldoneBidAdapter.js +1 -1
  244. package/package.json +1 -1
  245. package/src/Renderer.js +2 -1
  246. package/src/config.js +78 -127
  247. package/src/native.js +5 -1
  248. package/test/spec/auctionmanager_spec.js +2 -2
  249. package/test/spec/libraries/domainOverrideToRootDomain/index_spec.js +77 -0
  250. package/test/spec/modules/1plusXRtdProvider_spec.js +8 -7
  251. package/test/spec/modules/acuityAdsBidAdapter_spec.js +2 -1
  252. package/test/spec/modules/adagioBidAdapter_spec.js +0 -25
  253. package/test/spec/modules/admaticBidAdapter_spec.js +1 -1
  254. package/test/spec/modules/adnuntiusBidAdapter_spec.js +2 -1
  255. package/test/spec/modules/amxIdSystem_spec.js +13 -26
  256. package/test/spec/modules/appnexusBidAdapter_spec.js +464 -448
  257. package/test/spec/modules/appushBidAdapter_spec.js +2 -1
  258. package/test/spec/modules/axonixBidAdapter_spec.js +0 -27
  259. package/test/spec/modules/beyondmediaBidAdapter_spec.js +2 -1
  260. package/test/spec/modules/big-richmediaBidAdapter_spec.js +68 -64
  261. package/test/spec/modules/compassBidAdapter_spec.js +2 -1
  262. package/test/spec/modules/connectIdSystem_spec.js +420 -242
  263. package/test/spec/modules/contentexchangeBidAdapter_spec.js +2 -1
  264. package/test/spec/modules/conversantBidAdapter_spec.js +1 -0
  265. package/test/spec/modules/criteoBidAdapter_spec.js +33 -1
  266. package/test/spec/modules/eids_spec.js +30 -0
  267. package/test/spec/modules/eskimiBidAdapter_spec.js +155 -0
  268. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +37 -0
  269. package/test/spec/modules/globalsunBidAdapter_spec.js +2 -1
  270. package/test/spec/modules/gridBidAdapter_spec.js +8 -0
  271. package/test/spec/modules/iqzoneBidAdapter_spec.js +2 -1
  272. package/test/spec/modules/ivsBidAdapter_spec.js +197 -0
  273. package/test/spec/modules/ixBidAdapter_spec.js +141 -71
  274. package/test/spec/modules/kargoBidAdapter_spec.js +297 -140
  275. package/test/spec/modules/koblerBidAdapter_spec.js +0 -20
  276. package/test/spec/modules/kueezRtbBidAdapter_spec.js +22 -2
  277. package/test/spec/modules/liveIntentIdSystem_spec.js +10 -0
  278. package/test/spec/modules/luponmediaBidAdapter_spec.js +1 -1
  279. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +129 -1
  280. package/test/spec/modules/mathildeadsBidAdapter_spec.js +2 -1
  281. package/test/spec/modules/mgidBidAdapter_spec.js +184 -36
  282. package/test/spec/modules/minutemediaplusBidAdapter_spec.js +22 -2
  283. package/test/spec/modules/nativoBidAdapter_spec.js +101 -0
  284. package/test/spec/modules/neuwoRtdProvider_spec.js +0 -1
  285. package/test/spec/modules/oguryBidAdapter_spec.js +19 -4
  286. package/test/spec/modules/ooloAnalyticsAdapter_spec.js +1 -1
  287. package/test/spec/modules/openxBidAdapter_spec.js +1157 -1936
  288. package/test/spec/modules/openxOrtbBidAdapter_spec.js +12 -39
  289. package/test/spec/modules/pairIdSystem_spec.js +68 -0
  290. package/test/spec/modules/pubCommonId_spec.js +0 -17
  291. package/test/spec/modules/pubmaticBidAdapter_spec.js +868 -867
  292. package/test/spec/modules/pubxBidAdapter_spec.js +10 -2
  293. package/test/spec/modules/realvuAnalyticsAdapter_spec.js +0 -5
  294. package/test/spec/modules/sharedIdSystem_spec.js +0 -46
  295. package/test/spec/modules/sharethroughBidAdapter_spec.js +2 -1
  296. package/test/spec/modules/smarthubBidAdapter_spec.js +2 -1
  297. package/test/spec/modules/synacormediaBidAdapter_spec.js +0 -26
  298. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +17 -4
  299. package/test/spec/modules/vidoomyBidAdapter_spec.js +58 -0
  300. package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +2 -1
  301. package/test/spec/modules/vrtcalBidAdapter_spec.js +3 -2
  302. package/test/spec/modules/yieldmoBidAdapter_spec.js +19 -1
  303. package/test/spec/renderer_spec.js +1 -2
  304. package/test/spec/unit/pbjs_api_spec.js +19 -3
  305. package/test/test_index.js +13 -3
  306. package/dist/gridNMBidAdapter.js +0 -1
  307. package/modules/gridNMBidAdapter.js +0 -422
  308. package/modules/gridNMBidAdapter.md +0 -39
  309. package/test/spec/modules/gridNMBidAdapter_spec.js +0 -636
@@ -850,12 +850,86 @@ describe('PubMatic adapter', function () {
850
850
  expect(isValid).to.equal(true);
851
851
  });
852
852
 
853
- it('should check for context if video is present', function() {
854
- let bid = {
853
+ if (FEATURES.VIDEO) {
854
+ it('should check for context if video is present', function() {
855
+ let bid = {
856
+ 'bidder': 'pubmatic',
857
+ 'params': {
858
+ 'adSlot': 'SLOT_NHB1@728x90',
859
+ 'publisherId': '5890'
860
+ },
861
+ 'mediaTypes': {
862
+ 'video': {
863
+ 'playerSize': [
864
+ [640, 480]
865
+ ],
866
+ 'protocols': [1, 2, 5],
867
+ 'context': 'instream',
868
+ 'mimes': ['video/flv'],
869
+ 'skippable': false,
870
+ 'skip': 1,
871
+ 'linearity': 2
872
+ }
873
+ },
874
+ 'adUnitCode': 'video1',
875
+ 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
876
+ 'sizes': [
877
+ [640, 480]
878
+ ],
879
+ 'bidId': '2c95df014cfe97',
880
+ 'bidderRequestId': '1fe59391566442',
881
+ 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
882
+ 'src': 'client',
883
+ 'bidRequestsCount': 1,
884
+ 'bidderRequestsCount': 1,
885
+ 'bidderWinsCount': 0
886
+ },
887
+ isValid = spec.isBidRequestValid(bid);
888
+ expect(isValid).to.equal(true);
889
+ })
890
+
891
+ it('should return false if context is not present in video', function() {
892
+ let bid = {
893
+ 'bidder': 'pubmatic',
894
+ 'params': {
895
+ 'adSlot': 'SLOT_NHB1@728x90',
896
+ 'publisherId': '5890'
897
+ },
898
+ 'mediaTypes': {
899
+ 'video': {
900
+ 'w': 640,
901
+ 'h': 480,
902
+ 'protocols': [1, 2, 5],
903
+ 'mimes': ['video/flv'],
904
+ 'skippable': false,
905
+ 'skip': 1,
906
+ 'linearity': 2
907
+ }
908
+ },
909
+ 'adUnitCode': 'video1',
910
+ 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
911
+ 'sizes': [
912
+ [640, 480]
913
+ ],
914
+ 'bidId': '2c95df014cfe97',
915
+ 'bidderRequestId': '1fe59391566442',
916
+ 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
917
+ 'src': 'client',
918
+ 'bidRequestsCount': 1,
919
+ 'bidderRequestsCount': 1,
920
+ 'bidderWinsCount': 0
921
+ },
922
+ isValid = spec.isBidRequestValid(bid);
923
+ expect(isValid).to.equal(false);
924
+ })
925
+
926
+ it('bid.mediaTypes.video.mimes OR bid.params.video.mimes should be present and must be a non-empty array', function() {
927
+ let bid = {
855
928
  'bidder': 'pubmatic',
856
929
  'params': {
857
930
  'adSlot': 'SLOT_NHB1@728x90',
858
- 'publisherId': '5890'
931
+ 'publisherId': '5890',
932
+ 'video': {}
859
933
  },
860
934
  'mediaTypes': {
861
935
  'video': {
@@ -864,42 +938,6 @@ describe('PubMatic adapter', function () {
864
938
  ],
865
939
  'protocols': [1, 2, 5],
866
940
  'context': 'instream',
867
- 'mimes': ['video/flv'],
868
- 'skippable': false,
869
- 'skip': 1,
870
- 'linearity': 2
871
- }
872
- },
873
- 'adUnitCode': 'video1',
874
- 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
875
- 'sizes': [
876
- [640, 480]
877
- ],
878
- 'bidId': '2c95df014cfe97',
879
- 'bidderRequestId': '1fe59391566442',
880
- 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
881
- 'src': 'client',
882
- 'bidRequestsCount': 1,
883
- 'bidderRequestsCount': 1,
884
- 'bidderWinsCount': 0
885
- },
886
- isValid = spec.isBidRequestValid(bid);
887
- expect(isValid).to.equal(true);
888
- })
889
-
890
- it('should return false if context is not present in video', function() {
891
- let bid = {
892
- 'bidder': 'pubmatic',
893
- 'params': {
894
- 'adSlot': 'SLOT_NHB1@728x90',
895
- 'publisherId': '5890'
896
- },
897
- 'mediaTypes': {
898
- 'video': {
899
- 'w': 640,
900
- 'h': 480,
901
- 'protocols': [1, 2, 5],
902
- 'mimes': ['video/flv'],
903
941
  'skippable': false,
904
942
  'skip': 1,
905
943
  'linearity': 2
@@ -917,160 +955,124 @@ describe('PubMatic adapter', function () {
917
955
  'bidRequestsCount': 1,
918
956
  'bidderRequestsCount': 1,
919
957
  'bidderWinsCount': 0
920
- },
921
- isValid = spec.isBidRequestValid(bid);
922
- expect(isValid).to.equal(false);
923
- })
924
-
925
- it('bid.mediaTypes.video.mimes OR bid.params.video.mimes should be present and must be a non-empty array', function() {
926
- let bid = {
927
- 'bidder': 'pubmatic',
928
- 'params': {
929
- 'adSlot': 'SLOT_NHB1@728x90',
930
- 'publisherId': '5890',
931
- 'video': {}
932
- },
933
- 'mediaTypes': {
934
- 'video': {
935
- 'playerSize': [
936
- [640, 480]
937
- ],
938
- 'protocols': [1, 2, 5],
939
- 'context': 'instream',
940
- 'skippable': false,
941
- 'skip': 1,
942
- 'linearity': 2
943
- }
944
- },
945
- 'adUnitCode': 'video1',
946
- 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
947
- 'sizes': [
948
- [640, 480]
949
- ],
950
- 'bidId': '2c95df014cfe97',
951
- 'bidderRequestId': '1fe59391566442',
952
- 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
953
- 'src': 'client',
954
- 'bidRequestsCount': 1,
955
- 'bidderRequestsCount': 1,
956
- 'bidderWinsCount': 0
957
- };
958
+ };
958
959
 
959
- delete bid.params.video.mimes; // Undefined
960
- bid.mediaTypes.video.mimes = 'string'; // NOT array
961
- expect(spec.isBidRequestValid(bid)).to.equal(false);
960
+ delete bid.params.video.mimes; // Undefined
961
+ bid.mediaTypes.video.mimes = 'string'; // NOT array
962
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
962
963
 
963
- delete bid.params.video.mimes; // Undefined
964
- delete bid.mediaTypes.video.mimes; // Undefined
965
- expect(spec.isBidRequestValid(bid)).to.equal(false);
964
+ delete bid.params.video.mimes; // Undefined
965
+ delete bid.mediaTypes.video.mimes; // Undefined
966
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
966
967
 
967
- delete bid.params.video.mimes; // Undefined
968
- bid.mediaTypes.video.mimes = ['video/flv']; // Valid
969
- expect(spec.isBidRequestValid(bid)).to.equal(true);
968
+ delete bid.params.video.mimes; // Undefined
969
+ bid.mediaTypes.video.mimes = ['video/flv']; // Valid
970
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
970
971
 
971
- delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined
972
- bid.params.video = {mimes: 'string'}; // NOT array
973
- expect(spec.isBidRequestValid(bid)).to.equal(false);
972
+ delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined
973
+ bid.params.video = {mimes: 'string'}; // NOT array
974
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
974
975
 
975
- delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined
976
- delete bid.params.video.mimes; // Undefined
977
- expect(spec.isBidRequestValid(bid)).to.equal(false);
976
+ delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined
977
+ delete bid.params.video.mimes; // Undefined
978
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
978
979
 
979
- delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined
980
- bid.params.video.mimes = ['video/flv']; // Valid
981
- expect(spec.isBidRequestValid(bid)).to.equal(true);
980
+ delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined
981
+ bid.params.video.mimes = ['video/flv']; // Valid
982
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
982
983
 
983
- delete bid.mediaTypes.video.mimes; // Undefined
984
- bid.params.video.mimes = ['video/flv']; // Valid
985
- expect(spec.isBidRequestValid(bid)).to.equal(true);
984
+ delete bid.mediaTypes.video.mimes; // Undefined
985
+ bid.params.video.mimes = ['video/flv']; // Valid
986
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
986
987
 
987
- delete bid.mediaTypes.video.mimes; // Undefined
988
- delete bid.params.video.mimes; // Undefined
989
- expect(spec.isBidRequestValid(bid)).to.equal(false);
990
- });
988
+ delete bid.mediaTypes.video.mimes; // Undefined
989
+ delete bid.params.video.mimes; // Undefined
990
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
991
+ });
991
992
 
992
- it('checks on bid.params.outstreamAU & bid.renderer & bid.mediaTypes.video.renderer', function() {
993
- const getThebid = function() {
994
- let bid = utils.deepClone(validOutstreamBidRequest.bids[0]);
995
- bid.params.outstreamAU = 'pubmatic-test';
996
- bid.renderer = ' '; // we are only checking if this key is set or not
997
- bid.mediaTypes.video.renderer = ' '; // we are only checking if this key is set or not
998
- return bid;
999
- }
993
+ it('checks on bid.params.outstreamAU & bid.renderer & bid.mediaTypes.video.renderer', function() {
994
+ const getThebid = function() {
995
+ let bid = utils.deepClone(validOutstreamBidRequest.bids[0]);
996
+ bid.params.outstreamAU = 'pubmatic-test';
997
+ bid.renderer = ' '; // we are only checking if this key is set or not
998
+ bid.mediaTypes.video.renderer = ' '; // we are only checking if this key is set or not
999
+ return bid;
1000
+ }
1000
1001
 
1001
- // true: when all are present
1002
- // mdiatype: outstream
1003
- // bid.params.outstreamAU : Y
1004
- // bid.renderer : Y
1005
- // bid.mediaTypes.video.renderer : Y
1006
- let bid = getThebid();
1007
- expect(spec.isBidRequestValid(bid)).to.equal(true);
1008
-
1009
- // true: atleast one is present; 3 cases
1010
- // mdiatype: outstream
1011
- // bid.params.outstreamAU : Y
1012
- // bid.renderer : N
1013
- // bid.mediaTypes.video.renderer : N
1014
- bid = getThebid();
1015
- delete bid.renderer;
1016
- delete bid.mediaTypes.video.renderer;
1017
- expect(spec.isBidRequestValid(bid)).to.equal(true);
1018
-
1019
- // true: atleast one is present; 3 cases
1020
- // mdiatype: outstream
1021
- // bid.params.outstreamAU : N
1022
- // bid.renderer : Y
1023
- // bid.mediaTypes.video.renderer : N
1024
- bid = getThebid();
1025
- delete bid.params.outstreamAU;
1026
- delete bid.mediaTypes.video.renderer;
1027
- expect(spec.isBidRequestValid(bid)).to.equal(true);
1028
-
1029
- // true: atleast one is present; 3 cases
1030
- // mdiatype: outstream
1031
- // bid.params.outstreamAU : N
1032
- // bid.renderer : N
1033
- // bid.mediaTypes.video.renderer : Y
1034
- bid = getThebid();
1035
- delete bid.params.outstreamAU;
1036
- delete bid.renderer;
1037
- expect(spec.isBidRequestValid(bid)).to.equal(true);
1038
-
1039
- // false: none present; only outstream
1040
- // mdiatype: outstream
1041
- // bid.params.outstreamAU : N
1042
- // bid.renderer : N
1043
- // bid.mediaTypes.video.renderer : N
1044
- bid = getThebid();
1045
- delete bid.params.outstreamAU;
1046
- delete bid.renderer;
1047
- delete bid.mediaTypes.video.renderer;
1048
- expect(spec.isBidRequestValid(bid)).to.equal(false);
1049
-
1050
- // true: none present; outstream + Banner
1051
- // mdiatype: outstream, banner
1052
- // bid.params.outstreamAU : N
1053
- // bid.renderer : N
1054
- // bid.mediaTypes.video.renderer : N
1055
- bid = getThebid();
1056
- delete bid.params.outstreamAU;
1057
- delete bid.renderer;
1058
- delete bid.mediaTypes.video.renderer;
1059
- bid.mediaTypes.banner = {sizes: [ [300, 250], [300, 600] ]};
1060
- expect(spec.isBidRequestValid(bid)).to.equal(true);
1061
-
1062
- // true: none present; outstream + Native
1063
- // mdiatype: outstream, native
1064
- // bid.params.outstreamAU : N
1065
- // bid.renderer : N
1066
- // bid.mediaTypes.video.renderer : N
1067
- bid = getThebid();
1068
- delete bid.params.outstreamAU;
1069
- delete bid.renderer;
1070
- delete bid.mediaTypes.video.renderer;
1071
- bid.mediaTypes.native = {}
1072
- expect(spec.isBidRequestValid(bid)).to.equal(true);
1073
- });
1002
+ // true: when all are present
1003
+ // mdiatype: outstream
1004
+ // bid.params.outstreamAU : Y
1005
+ // bid.renderer : Y
1006
+ // bid.mediaTypes.video.renderer : Y
1007
+ let bid = getThebid();
1008
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
1009
+
1010
+ // true: atleast one is present; 3 cases
1011
+ // mdiatype: outstream
1012
+ // bid.params.outstreamAU : Y
1013
+ // bid.renderer : N
1014
+ // bid.mediaTypes.video.renderer : N
1015
+ bid = getThebid();
1016
+ delete bid.renderer;
1017
+ delete bid.mediaTypes.video.renderer;
1018
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
1019
+
1020
+ // true: atleast one is present; 3 cases
1021
+ // mdiatype: outstream
1022
+ // bid.params.outstreamAU : N
1023
+ // bid.renderer : Y
1024
+ // bid.mediaTypes.video.renderer : N
1025
+ bid = getThebid();
1026
+ delete bid.params.outstreamAU;
1027
+ delete bid.mediaTypes.video.renderer;
1028
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
1029
+
1030
+ // true: atleast one is present; 3 cases
1031
+ // mdiatype: outstream
1032
+ // bid.params.outstreamAU : N
1033
+ // bid.renderer : N
1034
+ // bid.mediaTypes.video.renderer : Y
1035
+ bid = getThebid();
1036
+ delete bid.params.outstreamAU;
1037
+ delete bid.renderer;
1038
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
1039
+
1040
+ // false: none present; only outstream
1041
+ // mdiatype: outstream
1042
+ // bid.params.outstreamAU : N
1043
+ // bid.renderer : N
1044
+ // bid.mediaTypes.video.renderer : N
1045
+ bid = getThebid();
1046
+ delete bid.params.outstreamAU;
1047
+ delete bid.renderer;
1048
+ delete bid.mediaTypes.video.renderer;
1049
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
1050
+
1051
+ // true: none present; outstream + Banner
1052
+ // mdiatype: outstream, banner
1053
+ // bid.params.outstreamAU : N
1054
+ // bid.renderer : N
1055
+ // bid.mediaTypes.video.renderer : N
1056
+ bid = getThebid();
1057
+ delete bid.params.outstreamAU;
1058
+ delete bid.renderer;
1059
+ delete bid.mediaTypes.video.renderer;
1060
+ bid.mediaTypes.banner = {sizes: [ [300, 250], [300, 600] ]};
1061
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
1062
+
1063
+ // true: none present; outstream + Native
1064
+ // mdiatype: outstream, native
1065
+ // bid.params.outstreamAU : N
1066
+ // bid.renderer : N
1067
+ // bid.mediaTypes.video.renderer : N
1068
+ bid = getThebid();
1069
+ delete bid.params.outstreamAU;
1070
+ delete bid.renderer;
1071
+ delete bid.mediaTypes.video.renderer;
1072
+ bid.mediaTypes.native = {}
1073
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
1074
+ });
1075
+ }
1074
1076
  });
1075
1077
 
1076
1078
  describe('Request formation', function () {
@@ -1116,18 +1118,6 @@ describe('PubMatic adapter', function () {
1116
1118
  expect(data.test).to.equal(undefined);
1117
1119
  });
1118
1120
 
1119
- // disabled this test case as it refreshes the whole suite when in karma watch mode
1120
- // todo: needs a fix
1121
- xit('test flag set to 1 when pubmaticTest=true is present in page url', function() {
1122
- window.location.href += '#pubmaticTest=true';
1123
- // now all the test cases below will have window.location.href with #pubmaticTest=true
1124
- let request = spec.buildRequests(bidRequests, {
1125
- auctionId: 'new-auction-id'
1126
- });
1127
- let data = JSON.parse(request.data);
1128
- expect(data.test).to.equal(1);
1129
- });
1130
-
1131
1121
  it('Request params check', function () {
1132
1122
  let request = spec.buildRequests(bidRequests, {
1133
1123
  auctionId: 'new-auction-id'
@@ -2055,29 +2045,31 @@ describe('PubMatic adapter', function () {
2055
2045
  expect(data.bidfloor).to.equal(undefined);
2056
2046
  });
2057
2047
 
2058
- it('ignore floormodule o/p if floor is not number', function() {
2059
- floorModuleTestData.banner['300x250'].floor = 'Not-a-Number';
2060
- floorModuleTestData.banner['300x600'].floor = 'Not-a-Number';
2061
- newRequest[0].params.kadfloor = undefined;
2062
- let request = spec.buildRequests(newRequest, {
2063
- auctionId: 'new-auction-id'
2048
+ if (FEATURES.VIDEO) {
2049
+ it('ignore floormodule o/p if floor is not number', function() {
2050
+ floorModuleTestData.banner['300x250'].floor = 'Not-a-Number';
2051
+ floorModuleTestData.banner['300x600'].floor = 'Not-a-Number';
2052
+ newRequest[0].params.kadfloor = undefined;
2053
+ let request = spec.buildRequests(newRequest, {
2054
+ auctionId: 'new-auction-id'
2055
+ });
2056
+ let data = JSON.parse(request.data);
2057
+ data = data.imp[0];
2058
+ expect(data.bidfloor).to.equal(2.5); // video will be lowest now
2064
2059
  });
2065
- let data = JSON.parse(request.data);
2066
- data = data.imp[0];
2067
- expect(data.bidfloor).to.equal(2.5); // video will be lowest now
2068
- });
2069
2060
 
2070
- it('ignore floormodule o/p if currency is not matched', function() {
2071
- floorModuleTestData.banner['300x250'].currency = 'INR';
2072
- floorModuleTestData.banner['300x600'].currency = 'INR';
2073
- newRequest[0].params.kadfloor = undefined;
2074
- let request = spec.buildRequests(newRequest, {
2075
- auctionId: 'new-auction-id'
2061
+ it('ignore floormodule o/p if currency is not matched', function() {
2062
+ floorModuleTestData.banner['300x250'].currency = 'INR';
2063
+ floorModuleTestData.banner['300x600'].currency = 'INR';
2064
+ newRequest[0].params.kadfloor = undefined;
2065
+ let request = spec.buildRequests(newRequest, {
2066
+ auctionId: 'new-auction-id'
2067
+ });
2068
+ let data = JSON.parse(request.data);
2069
+ data = data.imp[0];
2070
+ expect(data.bidfloor).to.equal(2.5); // video will be lowest now
2076
2071
  });
2077
- let data = JSON.parse(request.data);
2078
- data = data.imp[0];
2079
- expect(data.bidfloor).to.equal(2.5); // video will be lowest now
2080
- });
2072
+ }
2081
2073
 
2082
2074
  it('kadfloor is not passed, use minimum from floorModule', function() {
2083
2075
  newRequest[0].params.kadfloor = undefined;
@@ -2556,114 +2548,6 @@ describe('PubMatic adapter', function () {
2556
2548
  });
2557
2549
  });
2558
2550
 
2559
- it('Request params check for video ad', function () {
2560
- let request = spec.buildRequests(videoBidRequests, {
2561
- auctionId: 'new-auction-id'
2562
- });
2563
- let data = JSON.parse(request.data);
2564
- expect(data.imp[0].video).to.exist;
2565
- expect(data.imp[0].tagid).to.equal('Div1');
2566
- expect(data.imp[0]['video']['mimes']).to.exist.and.to.be.an('array');
2567
- expect(data.imp[0]['video']['mimes'][0]).to.equal(videoBidRequests[0].params.video['mimes'][0]);
2568
- expect(data.imp[0]['video']['mimes'][1]).to.equal(videoBidRequests[0].params.video['mimes'][1]);
2569
- expect(data.imp[0]['video']['minduration']).to.equal(videoBidRequests[0].params.video['minduration']);
2570
- expect(data.imp[0]['video']['maxduration']).to.equal(videoBidRequests[0].params.video['maxduration']);
2571
- expect(data.imp[0]['video']['startdelay']).to.equal(videoBidRequests[0].params.video['startdelay']);
2572
-
2573
- expect(data.imp[0]['video']['playbackmethod']).to.exist.and.to.be.an('array');
2574
- expect(data.imp[0]['video']['playbackmethod'][0]).to.equal(videoBidRequests[0].params.video['playbackmethod'][0]);
2575
- expect(data.imp[0]['video']['playbackmethod'][1]).to.equal(videoBidRequests[0].params.video['playbackmethod'][1]);
2576
-
2577
- expect(data.imp[0]['video']['api']).to.exist.and.to.be.an('array');
2578
- expect(data.imp[0]['video']['api'][0]).to.equal(videoBidRequests[0].params.video['api'][0]);
2579
- expect(data.imp[0]['video']['api'][1]).to.equal(videoBidRequests[0].params.video['api'][1]);
2580
-
2581
- expect(data.imp[0]['video']['protocols']).to.exist.and.to.be.an('array');
2582
- expect(data.imp[0]['video']['protocols'][0]).to.equal(videoBidRequests[0].params.video['protocols'][0]);
2583
- expect(data.imp[0]['video']['protocols'][1]).to.equal(videoBidRequests[0].params.video['protocols'][1]);
2584
-
2585
- expect(data.imp[0]['video']['battr']).to.exist.and.to.be.an('array');
2586
- expect(data.imp[0]['video']['battr'][0]).to.equal(videoBidRequests[0].params.video['battr'][0]);
2587
- expect(data.imp[0]['video']['battr'][1]).to.equal(videoBidRequests[0].params.video['battr'][1]);
2588
-
2589
- expect(data.imp[0]['video']['linearity']).to.equal(videoBidRequests[0].params.video['linearity']);
2590
- expect(data.imp[0]['video']['placement']).to.equal(videoBidRequests[0].params.video['placement']);
2591
- expect(data.imp[0]['video']['minbitrate']).to.equal(videoBidRequests[0].params.video['minbitrate']);
2592
- expect(data.imp[0]['video']['maxbitrate']).to.equal(videoBidRequests[0].params.video['maxbitrate']);
2593
-
2594
- expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]);
2595
- expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]);
2596
- });
2597
-
2598
- it('Request params check for 1 banner and 1 video ad', function () {
2599
- let request = spec.buildRequests(multipleMediaRequests, {
2600
- auctionId: 'new-auction-id'
2601
- });
2602
- let data = JSON.parse(request.data);
2603
-
2604
- expect(data.imp).to.be.an('array')
2605
- expect(data.imp).with.length.above(1);
2606
-
2607
- expect(data.at).to.equal(1); // auction type
2608
- expect(data.cur[0]).to.equal('USD'); // currency
2609
- expect(data.site.domain).to.be.a('string'); // domain should be set
2610
- expect(data.site.page).to.equal(multipleMediaRequests[0].params.kadpageurl); // forced pageURL
2611
- expect(data.site.publisher.id).to.equal(multipleMediaRequests[0].params.publisherId); // publisher Id
2612
- expect(data.user.yob).to.equal(parseInt(multipleMediaRequests[0].params.yob)); // YOB
2613
- expect(data.user.gender).to.equal(multipleMediaRequests[0].params.gender); // Gender
2614
- expect(data.device.geo.lat).to.equal(parseFloat(multipleMediaRequests[0].params.lat)); // Latitude
2615
- expect(data.device.geo.lon).to.equal(parseFloat(multipleMediaRequests[0].params.lon)); // Lognitude
2616
- expect(data.user.geo.lat).to.equal(parseFloat(multipleMediaRequests[0].params.lat)); // Latitude
2617
- expect(data.user.geo.lon).to.equal(parseFloat(multipleMediaRequests[0].params.lon)); // Lognitude
2618
- expect(data.ext.wrapper.wv).to.equal($$REPO_AND_VERSION$$); // Wrapper Version
2619
- expect(data.ext.wrapper.transactionId).to.equal(multipleMediaRequests[0].transactionId); // Prebid TransactionId
2620
- expect(data.ext.wrapper.wiid).to.equal(multipleMediaRequests[0].params.wiid); // OpenWrap: Wrapper Impression ID
2621
- expect(data.ext.wrapper.profile).to.equal(parseInt(multipleMediaRequests[0].params.profId)); // OpenWrap: Wrapper Profile ID
2622
- expect(data.ext.wrapper.version).to.equal(parseInt(multipleMediaRequests[0].params.verId)); // OpenWrap: Wrapper Profile Version ID
2623
-
2624
- // banner imp object check
2625
- expect(data.imp[0].id).to.equal(multipleMediaRequests[0].bidId); // Prebid bid id is passed as id
2626
- expect(data.imp[0].bidfloor).to.equal(parseFloat(multipleMediaRequests[0].params.kadfloor)); // kadfloor
2627
- expect(data.imp[0].tagid).to.equal('/15671365/DMDemo'); // tagid
2628
- expect(data.imp[0].banner.w).to.equal(300); // width
2629
- expect(data.imp[0].banner.h).to.equal(250); // height
2630
- expect(data.imp[0].ext.pmZoneId).to.equal(multipleMediaRequests[0].params.pmzoneid.split(',').slice(0, 50).map(id => id.trim()).join()); // pmzoneid
2631
-
2632
- // video imp object check
2633
- expect(data.imp[1].video).to.exist;
2634
- expect(data.imp[1].tagid).to.equal('Div1');
2635
- expect(data.imp[1]['video']['mimes']).to.exist.and.to.be.an('array');
2636
- expect(data.imp[1]['video']['mimes'][0]).to.equal(multipleMediaRequests[1].params.video['mimes'][0]);
2637
- expect(data.imp[1]['video']['mimes'][1]).to.equal(multipleMediaRequests[1].params.video['mimes'][1]);
2638
- expect(data.imp[1]['video']['minduration']).to.equal(multipleMediaRequests[1].params.video['minduration']);
2639
- expect(data.imp[1]['video']['maxduration']).to.equal(multipleMediaRequests[1].params.video['maxduration']);
2640
- expect(data.imp[1]['video']['startdelay']).to.equal(multipleMediaRequests[1].params.video['startdelay']);
2641
-
2642
- expect(data.imp[1]['video']['playbackmethod']).to.exist.and.to.be.an('array');
2643
- expect(data.imp[1]['video']['playbackmethod'][0]).to.equal(multipleMediaRequests[1].params.video['playbackmethod'][0]);
2644
- expect(data.imp[1]['video']['playbackmethod'][1]).to.equal(multipleMediaRequests[1].params.video['playbackmethod'][1]);
2645
-
2646
- expect(data.imp[1]['video']['api']).to.exist.and.to.be.an('array');
2647
- expect(data.imp[1]['video']['api'][0]).to.equal(multipleMediaRequests[1].params.video['api'][0]);
2648
- expect(data.imp[1]['video']['api'][1]).to.equal(multipleMediaRequests[1].params.video['api'][1]);
2649
-
2650
- expect(data.imp[1]['video']['protocols']).to.exist.and.to.be.an('array');
2651
- expect(data.imp[1]['video']['protocols'][0]).to.equal(multipleMediaRequests[1].params.video['protocols'][0]);
2652
- expect(data.imp[1]['video']['protocols'][1]).to.equal(multipleMediaRequests[1].params.video['protocols'][1]);
2653
-
2654
- expect(data.imp[1]['video']['battr']).to.exist.and.to.be.an('array');
2655
- expect(data.imp[1]['video']['battr'][0]).to.equal(multipleMediaRequests[1].params.video['battr'][0]);
2656
- expect(data.imp[1]['video']['battr'][1]).to.equal(multipleMediaRequests[1].params.video['battr'][1]);
2657
-
2658
- expect(data.imp[1]['video']['linearity']).to.equal(multipleMediaRequests[1].params.video['linearity']);
2659
- expect(data.imp[1]['video']['placement']).to.equal(multipleMediaRequests[1].params.video['placement']);
2660
- expect(data.imp[1]['video']['minbitrate']).to.equal(multipleMediaRequests[1].params.video['minbitrate']);
2661
- expect(data.imp[1]['video']['maxbitrate']).to.equal(multipleMediaRequests[1].params.video['maxbitrate']);
2662
-
2663
- expect(data.imp[1]['video']['w']).to.equal(multipleMediaRequests[1].mediaTypes.video.playerSize[0]);
2664
- expect(data.imp[1]['video']['h']).to.equal(multipleMediaRequests[1].mediaTypes.video.playerSize[1]);
2665
- });
2666
-
2667
2551
  it('should pass device.sua if present in bidderRequest fpd ortb2 object', function () {
2668
2552
  const suaObject = {'source': 2, 'platform': {'brand': 'macOS', 'version': ['12', '4', '0']}, 'browsers': [{'brand': 'Not_A Brand', 'version': ['99', '0', '0', '0']}, {'brand': 'Google Chrome', 'version': ['109', '0', '5414', '119']}, {'brand': 'Chromium', 'version': ['109', '0', '5414', '119']}], 'mobile': 0, 'model': '', 'bitness': '64', 'architecture': 'x86'};
2669
2553
  let request = spec.buildRequests(multipleMediaRequests, {
@@ -2723,127 +2607,6 @@ describe('PubMatic adapter', function () {
2723
2607
  expect(data.imp[0]['native']['request']).to.exist.and.to.equal(validnativeBidImpressionWithAllParams.native.request);
2724
2608
  });
2725
2609
 
2726
- it('Request params - should handle banner and video format in single adunit', function() {
2727
- let request = spec.buildRequests(bannerAndVideoBidRequests, {
2728
- auctionId: 'new-auction-id'
2729
- });
2730
- let data = JSON.parse(request.data);
2731
- data = data.imp[0];
2732
- expect(data.banner).to.exist;
2733
- expect(data.banner.w).to.equal(300);
2734
- expect(data.banner.h).to.equal(250);
2735
- expect(data.banner.format).to.exist;
2736
- expect(data.banner.format.length).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes.length);
2737
-
2738
- // Case: when size is not present in adslo
2739
- bannerAndVideoBidRequests[0].params.adSlot = '/15671365/DMDemo';
2740
- request = spec.buildRequests(bannerAndVideoBidRequests, {
2741
- auctionId: 'new-auction-id'
2742
- });
2743
- data = JSON.parse(request.data);
2744
- data = data.imp[0];
2745
- expect(data.banner).to.exist;
2746
- expect(data.banner.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes[0][0]);
2747
- expect(data.banner.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes[0][1]);
2748
- expect(data.banner.format).to.exist;
2749
- expect(data.banner.format.length).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes.length - 1);
2750
-
2751
- expect(data.video).to.exist;
2752
- expect(data.video.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[0]);
2753
- expect(data.video.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[1]);
2754
- });
2755
-
2756
- it('Request params - banner and video req in single adslot - should ignore banner imp if banner size is set to fluid and send video imp object', function () {
2757
- /* Adslot configured for banner and video.
2758
- banner size is set to [['fluid'], [300, 250]]
2759
- adslot specifies a size as 300x250
2760
- => banner imp object should have primary w and h set to 300 and 250. fluid is ignored
2761
- */
2762
- bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [['fluid'], [160, 600]];
2763
-
2764
- let request = spec.buildRequests(bannerAndVideoBidRequests, {
2765
- auctionId: 'new-auction-id'
2766
- });
2767
- let data = JSON.parse(request.data);
2768
- data = data.imp[0];
2769
-
2770
- expect(data.banner).to.exist;
2771
- expect(data.banner.w).to.equal(300);
2772
- expect(data.banner.h).to.equal(250);
2773
- expect(data.banner.format).to.exist;
2774
- expect(data.banner.format[0].w).to.equal(160);
2775
- expect(data.banner.format[0].h).to.equal(600);
2776
-
2777
- /* Adslot configured for banner and video.
2778
- banner size is set to [['fluid'], [300, 250]]
2779
- adslot does not specify any size
2780
- => banner imp object should have primary w and h set to 300 and 250. fluid is ignored
2781
- */
2782
- bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [['fluid'], [160, 600]];
2783
- bannerAndVideoBidRequests[0].params.adSlot = '/15671365/DMDemo';
2784
-
2785
- request = spec.buildRequests(bannerAndVideoBidRequests, {
2786
- auctionId: 'new-auction-id'
2787
- });
2788
- data = JSON.parse(request.data);
2789
- data = data.imp[0];
2790
-
2791
- expect(data.banner).to.exist;
2792
- expect(data.banner.w).to.equal(160);
2793
- expect(data.banner.h).to.equal(600);
2794
- expect(data.banner.format).to.not.exist;
2795
-
2796
- /* Adslot configured for banner and video.
2797
- banner size is set to [[728 90], ['fluid'], [300, 250]]
2798
- adslot does not specify any size
2799
- => banner imp object should have primary w and h set to 728 and 90.
2800
- banner.format should have 300, 250 set in it
2801
- fluid is ignore
2802
- */
2803
-
2804
- bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [[728, 90], ['fluid'], [300, 250]];
2805
- request = spec.buildRequests(bannerAndVideoBidRequests, {
2806
- auctionId: 'new-auction-id'
2807
- });
2808
- data = JSON.parse(request.data);
2809
- data = data.imp[0];
2810
-
2811
- expect(data.banner).to.exist;
2812
- expect(data.banner.w).to.equal(728);
2813
- expect(data.banner.h).to.equal(90);
2814
- expect(data.banner.format).to.exist;
2815
- expect(data.banner.format[0].w).to.equal(300);
2816
- expect(data.banner.format[0].h).to.equal(250);
2817
-
2818
- /* Adslot configured for banner and video.
2819
- banner size is set to [['fluid']]
2820
- adslot does not specify any size
2821
- => banner object should not be sent in the request. only video should be sent.
2822
- */
2823
-
2824
- bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [['fluid']];
2825
- request = spec.buildRequests(bannerAndVideoBidRequests, {
2826
- auctionId: 'new-auction-id'
2827
- });
2828
- data = JSON.parse(request.data);
2829
- data = data.imp[0];
2830
-
2831
- expect(data.banner).to.not.exist;
2832
- expect(data.video).to.exist;
2833
- });
2834
-
2835
- it('Request params - should not contain banner imp if mediaTypes.banner is not present and sizes is specified in bid.sizes', function() {
2836
- delete bannerAndVideoBidRequests[0].mediaTypes.banner;
2837
- bannerAndVideoBidRequests[0].params.sizes = [300, 250];
2838
-
2839
- let request = spec.buildRequests(bannerAndVideoBidRequests, {
2840
- auctionId: 'new-auction-id'
2841
- });
2842
- let data = JSON.parse(request.data);
2843
- data = data.imp[0];
2844
- expect(data.banner).to.not.exist;
2845
- });
2846
-
2847
2610
  it('Request params - should handle banner and native format in single adunit', function() {
2848
2611
  let request = spec.buildRequests(bannerAndNativeBidRequests, {
2849
2612
  auctionId: 'new-auction-id'
@@ -2861,58 +2624,6 @@ describe('PubMatic adapter', function () {
2861
2624
  expect(data.native.request).to.exist;
2862
2625
  });
2863
2626
 
2864
- it('Request params - should handle video and native format in single adunit', function() {
2865
- let request = spec.buildRequests(videoAndNativeBidRequests, {
2866
- auctionId: 'new-auction-id'
2867
- });
2868
- let data = JSON.parse(request.data);
2869
- data = data.imp[0];
2870
-
2871
- expect(data.video).to.exist;
2872
- expect(data.video.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[0]);
2873
- expect(data.video.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[1]);
2874
-
2875
- expect(data.native).to.exist;
2876
- expect(data.native.request).to.exist;
2877
- });
2878
-
2879
- it('Request params - should handle banner, video and native format in single adunit', function() {
2880
- let request = spec.buildRequests(bannerVideoAndNativeBidRequests, {
2881
- auctionId: 'new-auction-id'
2882
- });
2883
- let data = JSON.parse(request.data);
2884
- data = data.imp[0];
2885
-
2886
- expect(data.banner).to.exist;
2887
- expect(data.banner.w).to.equal(300);
2888
- expect(data.banner.h).to.equal(250);
2889
- expect(data.banner.format).to.exist;
2890
- expect(data.banner.format.length).to.equal(bannerAndNativeBidRequests[0].mediaTypes.banner.sizes.length);
2891
-
2892
- expect(data.video).to.exist;
2893
- expect(data.video.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[0]);
2894
- expect(data.video.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[1]);
2895
-
2896
- expect(data.native).to.exist;
2897
- expect(data.native.request).to.exist;
2898
- });
2899
-
2900
- it('Request params - should not add banner object if mediaTypes.banner is missing, but adunits.sizes is present', function() {
2901
- delete bannerAndNativeBidRequests[0].mediaTypes.banner;
2902
- bannerAndNativeBidRequests[0].sizes = [729, 90];
2903
-
2904
- let request = spec.buildRequests(bannerAndNativeBidRequests, {
2905
- auctionId: 'new-auction-id'
2906
- });
2907
- let data = JSON.parse(request.data);
2908
- data = data.imp[0];
2909
-
2910
- expect(data.banner).to.not.exist;
2911
-
2912
- expect(data.native).to.exist;
2913
- expect(data.native.request).to.exist;
2914
- });
2915
-
2916
2627
  it('Request params - banner and native multiformat request - should have native object incase of invalid config present', function() {
2917
2628
  bannerAndNativeBidRequests[0].mediaTypes.native = {
2918
2629
  title: { required: true },
@@ -2936,115 +2647,399 @@ describe('PubMatic adapter', function () {
2936
2647
  expect(data.native).to.exist;
2937
2648
  });
2938
2649
 
2939
- it('Request params - video and native multiformat request - should have native object incase of invalid config present', function() {
2940
- videoAndNativeBidRequests[0].mediaTypes.native = {
2941
- title: { required: true },
2942
- image: { required: true },
2943
- sponsoredBy: { required: true },
2944
- clickUrl: { required: true }
2945
- };
2946
- videoAndNativeBidRequests[0].nativeParams = {
2947
- title: { required: true },
2948
- image: { required: true },
2949
- sponsoredBy: { required: true },
2950
- clickUrl: { required: true }
2951
- }
2952
- let request = spec.buildRequests(videoAndNativeBidRequests, {
2650
+ it('Request params - should not add banner object if mediaTypes.banner is missing, but adunits.sizes is present', function() {
2651
+ delete bannerAndNativeBidRequests[0].mediaTypes.banner;
2652
+ bannerAndNativeBidRequests[0].sizes = [729, 90];
2653
+
2654
+ let request = spec.buildRequests(bannerAndNativeBidRequests, {
2953
2655
  auctionId: 'new-auction-id'
2954
2656
  });
2955
2657
  let data = JSON.parse(request.data);
2956
2658
  data = data.imp[0];
2957
2659
 
2958
- expect(data.video).to.exist;
2660
+ expect(data.banner).to.not.exist;
2661
+
2959
2662
  expect(data.native).to.exist;
2663
+ expect(data.native.request).to.exist;
2960
2664
  });
2961
2665
 
2962
- it('should build video impression if video params are present in adunit.mediaTypes instead of bid.params', function() {
2963
- let videoReq = [{
2964
- 'bidder': 'pubmatic',
2965
- 'params': {
2966
- 'adSlot': 'SLOT_NHB1@728x90',
2967
- 'publisherId': '5890',
2968
- },
2969
- 'mediaTypes': {
2970
- 'video': {
2971
- 'playerSize': [
2972
- [640, 480]
2973
- ],
2974
- 'protocols': [1, 2, 5],
2975
- 'context': 'instream',
2976
- 'mimes': ['video/flv'],
2977
- 'skip': 1,
2978
- 'linearity': 2
2979
- }
2980
- },
2981
- 'adUnitCode': 'video1',
2982
- 'transactionId': 'adc36682-887c-41e9-9848-8b72c08332c0',
2983
- 'sizes': [
2984
- [640, 480]
2985
- ],
2986
- 'bidId': '21b59b1353ba82',
2987
- 'bidderRequestId': '1a08245305e6dd',
2988
- 'auctionId': 'bad3a743-7491-4d19-9a96-b0a69dd24a67',
2989
- 'src': 'client',
2990
- 'bidRequestsCount': 1,
2991
- 'bidderRequestsCount': 1,
2992
- 'bidderWinsCount': 0
2993
- }]
2994
- let request = spec.buildRequests(videoReq, {
2995
- auctionId: 'new-auction-id'
2666
+ if (FEATURES.VIDEO) {
2667
+ it('Request params - should not contain banner imp if mediaTypes.banner is not present and sizes is specified in bid.sizes', function() {
2668
+ delete bannerAndVideoBidRequests[0].mediaTypes.banner;
2669
+ bannerAndVideoBidRequests[0].params.sizes = [300, 250];
2670
+
2671
+ let request = spec.buildRequests(bannerAndVideoBidRequests, {
2672
+ auctionId: 'new-auction-id'
2673
+ });
2674
+ let data = JSON.parse(request.data);
2675
+ data = data.imp[0];
2676
+ expect(data.banner).to.not.exist;
2996
2677
  });
2997
- let data = JSON.parse(request.data);
2998
- data = data.imp[0];
2999
- expect(data.video).to.exist;
3000
- });
3001
2678
 
3002
- it('should build video impression with overwriting video params present in adunit.mediaTypes with bid.params', function() {
3003
- let videoReq = [{
3004
- 'bidder': 'pubmatic',
3005
- 'params': {
3006
- 'adSlot': 'SLOT_NHB1@728x90',
3007
- 'publisherId': '5890',
3008
- 'video': {
3009
- 'mimes': ['video/mp4'],
3010
- 'protocols': [1, 2, 5],
3011
- 'linearity': 1
3012
- }
3013
- },
3014
- 'mediaTypes': {
3015
- 'video': {
3016
- 'playerSize': [
3017
- [640, 480]
3018
- ],
3019
- 'protocols': [1, 2, 5],
3020
- 'context': 'instream',
3021
- 'mimes': ['video/flv'],
3022
- 'skip': 1,
3023
- 'linearity': 2
3024
- }
3025
- },
3026
- 'adUnitCode': 'video1',
3027
- 'transactionId': 'adc36682-887c-41e9-9848-8b72c08332c0',
3028
- 'sizes': [
3029
- [640, 480]
3030
- ],
3031
- 'bidId': '21b59b1353ba82',
3032
- 'bidderRequestId': '1a08245305e6dd',
3033
- 'auctionId': 'bad3a743-7491-4d19-9a96-b0a69dd24a67',
3034
- 'src': 'client',
3035
- 'bidRequestsCount': 1,
3036
- 'bidderRequestsCount': 1,
3037
- 'bidderWinsCount': 0
3038
- }]
3039
- let request = spec.buildRequests(videoReq, {
3040
- auctionId: 'new-auction-id'
2679
+ it('Request params check for 1 banner and 1 video ad', function () {
2680
+ let request = spec.buildRequests(multipleMediaRequests, {
2681
+ auctionId: 'new-auction-id'
2682
+ });
2683
+ let data = JSON.parse(request.data);
2684
+
2685
+ expect(data.imp).to.be.an('array')
2686
+ expect(data.imp).with.length.above(1);
2687
+
2688
+ expect(data.at).to.equal(1); // auction type
2689
+ expect(data.cur[0]).to.equal('USD'); // currency
2690
+ expect(data.site.domain).to.be.a('string'); // domain should be set
2691
+ expect(data.site.page).to.equal(multipleMediaRequests[0].params.kadpageurl); // forced pageURL
2692
+ expect(data.site.publisher.id).to.equal(multipleMediaRequests[0].params.publisherId); // publisher Id
2693
+ expect(data.user.yob).to.equal(parseInt(multipleMediaRequests[0].params.yob)); // YOB
2694
+ expect(data.user.gender).to.equal(multipleMediaRequests[0].params.gender); // Gender
2695
+ expect(data.device.geo.lat).to.equal(parseFloat(multipleMediaRequests[0].params.lat)); // Latitude
2696
+ expect(data.device.geo.lon).to.equal(parseFloat(multipleMediaRequests[0].params.lon)); // Lognitude
2697
+ expect(data.user.geo.lat).to.equal(parseFloat(multipleMediaRequests[0].params.lat)); // Latitude
2698
+ expect(data.user.geo.lon).to.equal(parseFloat(multipleMediaRequests[0].params.lon)); // Lognitude
2699
+ expect(data.ext.wrapper.wv).to.equal($$REPO_AND_VERSION$$); // Wrapper Version
2700
+ expect(data.ext.wrapper.transactionId).to.equal(multipleMediaRequests[0].transactionId); // Prebid TransactionId
2701
+ expect(data.ext.wrapper.wiid).to.equal(multipleMediaRequests[0].params.wiid); // OpenWrap: Wrapper Impression ID
2702
+ expect(data.ext.wrapper.profile).to.equal(parseInt(multipleMediaRequests[0].params.profId)); // OpenWrap: Wrapper Profile ID
2703
+ expect(data.ext.wrapper.version).to.equal(parseInt(multipleMediaRequests[0].params.verId)); // OpenWrap: Wrapper Profile Version ID
2704
+
2705
+ // banner imp object check
2706
+ expect(data.imp[0].id).to.equal(multipleMediaRequests[0].bidId); // Prebid bid id is passed as id
2707
+ expect(data.imp[0].bidfloor).to.equal(parseFloat(multipleMediaRequests[0].params.kadfloor)); // kadfloor
2708
+ expect(data.imp[0].tagid).to.equal('/15671365/DMDemo'); // tagid
2709
+ expect(data.imp[0].banner.w).to.equal(300); // width
2710
+ expect(data.imp[0].banner.h).to.equal(250); // height
2711
+ expect(data.imp[0].ext.pmZoneId).to.equal(multipleMediaRequests[0].params.pmzoneid.split(',').slice(0, 50).map(id => id.trim()).join()); // pmzoneid
2712
+
2713
+ // video imp object check
2714
+ expect(data.imp[1].video).to.exist;
2715
+ expect(data.imp[1].tagid).to.equal('Div1');
2716
+ expect(data.imp[1]['video']['mimes']).to.exist.and.to.be.an('array');
2717
+ expect(data.imp[1]['video']['mimes'][0]).to.equal(multipleMediaRequests[1].params.video['mimes'][0]);
2718
+ expect(data.imp[1]['video']['mimes'][1]).to.equal(multipleMediaRequests[1].params.video['mimes'][1]);
2719
+ expect(data.imp[1]['video']['minduration']).to.equal(multipleMediaRequests[1].params.video['minduration']);
2720
+ expect(data.imp[1]['video']['maxduration']).to.equal(multipleMediaRequests[1].params.video['maxduration']);
2721
+ expect(data.imp[1]['video']['startdelay']).to.equal(multipleMediaRequests[1].params.video['startdelay']);
2722
+
2723
+ expect(data.imp[1]['video']['playbackmethod']).to.exist.and.to.be.an('array');
2724
+ expect(data.imp[1]['video']['playbackmethod'][0]).to.equal(multipleMediaRequests[1].params.video['playbackmethod'][0]);
2725
+ expect(data.imp[1]['video']['playbackmethod'][1]).to.equal(multipleMediaRequests[1].params.video['playbackmethod'][1]);
2726
+
2727
+ expect(data.imp[1]['video']['api']).to.exist.and.to.be.an('array');
2728
+ expect(data.imp[1]['video']['api'][0]).to.equal(multipleMediaRequests[1].params.video['api'][0]);
2729
+ expect(data.imp[1]['video']['api'][1]).to.equal(multipleMediaRequests[1].params.video['api'][1]);
2730
+
2731
+ expect(data.imp[1]['video']['protocols']).to.exist.and.to.be.an('array');
2732
+ expect(data.imp[1]['video']['protocols'][0]).to.equal(multipleMediaRequests[1].params.video['protocols'][0]);
2733
+ expect(data.imp[1]['video']['protocols'][1]).to.equal(multipleMediaRequests[1].params.video['protocols'][1]);
2734
+
2735
+ expect(data.imp[1]['video']['battr']).to.exist.and.to.be.an('array');
2736
+ expect(data.imp[1]['video']['battr'][0]).to.equal(multipleMediaRequests[1].params.video['battr'][0]);
2737
+ expect(data.imp[1]['video']['battr'][1]).to.equal(multipleMediaRequests[1].params.video['battr'][1]);
2738
+
2739
+ expect(data.imp[1]['video']['linearity']).to.equal(multipleMediaRequests[1].params.video['linearity']);
2740
+ expect(data.imp[1]['video']['placement']).to.equal(multipleMediaRequests[1].params.video['placement']);
2741
+ expect(data.imp[1]['video']['minbitrate']).to.equal(multipleMediaRequests[1].params.video['minbitrate']);
2742
+ expect(data.imp[1]['video']['maxbitrate']).to.equal(multipleMediaRequests[1].params.video['maxbitrate']);
2743
+
2744
+ expect(data.imp[1]['video']['w']).to.equal(multipleMediaRequests[1].mediaTypes.video.playerSize[0]);
2745
+ expect(data.imp[1]['video']['h']).to.equal(multipleMediaRequests[1].mediaTypes.video.playerSize[1]);
3041
2746
  });
3042
- let data = JSON.parse(request.data);
3043
- data = data.imp[0];
3044
2747
 
3045
- expect(data.video).to.exist;
3046
- expect(data.video.linearity).to.equal(1);
3047
- });
2748
+ // ================================================
2749
+ it('Request params - should handle banner and video format in single adunit', function() {
2750
+ let request = spec.buildRequests(bannerAndVideoBidRequests, {
2751
+ auctionId: 'new-auction-id'
2752
+ });
2753
+ let data = JSON.parse(request.data);
2754
+ data = data.imp[0];
2755
+ expect(data.banner).to.exist;
2756
+ expect(data.banner.w).to.equal(300);
2757
+ expect(data.banner.h).to.equal(250);
2758
+ expect(data.banner.format).to.exist;
2759
+ expect(data.banner.format.length).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes.length);
2760
+
2761
+ // Case: when size is not present in adslo
2762
+ bannerAndVideoBidRequests[0].params.adSlot = '/15671365/DMDemo';
2763
+ request = spec.buildRequests(bannerAndVideoBidRequests, {
2764
+ auctionId: 'new-auction-id'
2765
+ });
2766
+ data = JSON.parse(request.data);
2767
+ data = data.imp[0];
2768
+ expect(data.banner).to.exist;
2769
+ expect(data.banner.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes[0][0]);
2770
+ expect(data.banner.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes[0][1]);
2771
+ expect(data.banner.format).to.exist;
2772
+ expect(data.banner.format.length).to.equal(bannerAndVideoBidRequests[0].mediaTypes.banner.sizes.length - 1);
2773
+
2774
+ expect(data.video).to.exist;
2775
+ expect(data.video.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[0]);
2776
+ expect(data.video.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[1]);
2777
+ });
2778
+
2779
+ it('Request params - should handle banner, video and native format in single adunit', function() {
2780
+ let request = spec.buildRequests(bannerVideoAndNativeBidRequests, {
2781
+ auctionId: 'new-auction-id'
2782
+ });
2783
+ let data = JSON.parse(request.data);
2784
+ data = data.imp[0];
2785
+
2786
+ expect(data.banner).to.exist;
2787
+ expect(data.banner.w).to.equal(300);
2788
+ expect(data.banner.h).to.equal(250);
2789
+ expect(data.banner.format).to.exist;
2790
+ expect(data.banner.format.length).to.equal(bannerAndNativeBidRequests[0].mediaTypes.banner.sizes.length);
2791
+
2792
+ expect(data.video).to.exist;
2793
+ expect(data.video.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[0]);
2794
+ expect(data.video.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[1]);
2795
+
2796
+ expect(data.native).to.exist;
2797
+ expect(data.native.request).to.exist;
2798
+ });
2799
+
2800
+ it('Request params - should handle video and native format in single adunit', function() {
2801
+ let request = spec.buildRequests(videoAndNativeBidRequests, {
2802
+ auctionId: 'new-auction-id'
2803
+ });
2804
+ let data = JSON.parse(request.data);
2805
+ data = data.imp[0];
2806
+
2807
+ expect(data.video).to.exist;
2808
+ expect(data.video.w).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[0]);
2809
+ expect(data.video.h).to.equal(bannerAndVideoBidRequests[0].mediaTypes.video.playerSize[1]);
2810
+
2811
+ expect(data.native).to.exist;
2812
+ expect(data.native.request).to.exist;
2813
+ });
2814
+
2815
+ it('Request params - banner and video req in single adslot - should ignore banner imp if banner size is set to fluid and send video imp object', function () {
2816
+ /* Adslot configured for banner and video.
2817
+ banner size is set to [['fluid'], [300, 250]]
2818
+ adslot specifies a size as 300x250
2819
+ => banner imp object should have primary w and h set to 300 and 250. fluid is ignored
2820
+ */
2821
+ bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [['fluid'], [160, 600]];
2822
+
2823
+ let request = spec.buildRequests(bannerAndVideoBidRequests, {
2824
+ auctionId: 'new-auction-id'
2825
+ });
2826
+ let data = JSON.parse(request.data);
2827
+ data = data.imp[0];
2828
+
2829
+ expect(data.banner).to.exist;
2830
+ expect(data.banner.w).to.equal(300);
2831
+ expect(data.banner.h).to.equal(250);
2832
+ expect(data.banner.format).to.exist;
2833
+ expect(data.banner.format[0].w).to.equal(160);
2834
+ expect(data.banner.format[0].h).to.equal(600);
2835
+
2836
+ /* Adslot configured for banner and video.
2837
+ banner size is set to [['fluid'], [300, 250]]
2838
+ adslot does not specify any size
2839
+ => banner imp object should have primary w and h set to 300 and 250. fluid is ignored
2840
+ */
2841
+ bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [['fluid'], [160, 600]];
2842
+ bannerAndVideoBidRequests[0].params.adSlot = '/15671365/DMDemo';
2843
+
2844
+ request = spec.buildRequests(bannerAndVideoBidRequests, {
2845
+ auctionId: 'new-auction-id'
2846
+ });
2847
+ data = JSON.parse(request.data);
2848
+ data = data.imp[0];
2849
+
2850
+ expect(data.banner).to.exist;
2851
+ expect(data.banner.w).to.equal(160);
2852
+ expect(data.banner.h).to.equal(600);
2853
+ expect(data.banner.format).to.not.exist;
2854
+
2855
+ /* Adslot configured for banner and video.
2856
+ banner size is set to [[728 90], ['fluid'], [300, 250]]
2857
+ adslot does not specify any size
2858
+ => banner imp object should have primary w and h set to 728 and 90.
2859
+ banner.format should have 300, 250 set in it
2860
+ fluid is ignore
2861
+ */
2862
+
2863
+ bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [[728, 90], ['fluid'], [300, 250]];
2864
+ request = spec.buildRequests(bannerAndVideoBidRequests, {
2865
+ auctionId: 'new-auction-id'
2866
+ });
2867
+ data = JSON.parse(request.data);
2868
+ data = data.imp[0];
2869
+
2870
+ expect(data.banner).to.exist;
2871
+ expect(data.banner.w).to.equal(728);
2872
+ expect(data.banner.h).to.equal(90);
2873
+ expect(data.banner.format).to.exist;
2874
+ expect(data.banner.format[0].w).to.equal(300);
2875
+ expect(data.banner.format[0].h).to.equal(250);
2876
+
2877
+ /* Adslot configured for banner and video.
2878
+ banner size is set to [['fluid']]
2879
+ adslot does not specify any size
2880
+ => banner object should not be sent in the request. only video should be sent.
2881
+ */
2882
+
2883
+ bannerAndVideoBidRequests[0].mediaTypes.banner.sizes = [['fluid']];
2884
+ request = spec.buildRequests(bannerAndVideoBidRequests, {
2885
+ auctionId: 'new-auction-id'
2886
+ });
2887
+ data = JSON.parse(request.data);
2888
+ data = data.imp[0];
2889
+
2890
+ expect(data.banner).to.not.exist;
2891
+ expect(data.video).to.exist;
2892
+ });
2893
+
2894
+ it('Request params - video and native multiformat request - should have native object incase of invalid config present', function() {
2895
+ videoAndNativeBidRequests[0].mediaTypes.native = {
2896
+ title: { required: true },
2897
+ image: { required: true },
2898
+ sponsoredBy: { required: true },
2899
+ clickUrl: { required: true }
2900
+ };
2901
+ videoAndNativeBidRequests[0].nativeParams = {
2902
+ title: { required: true },
2903
+ image: { required: true },
2904
+ sponsoredBy: { required: true },
2905
+ clickUrl: { required: true }
2906
+ }
2907
+ let request = spec.buildRequests(videoAndNativeBidRequests, {
2908
+ auctionId: 'new-auction-id'
2909
+ });
2910
+ let data = JSON.parse(request.data);
2911
+ data = data.imp[0];
2912
+
2913
+ expect(data.video).to.exist;
2914
+ expect(data.native).to.exist;
2915
+ });
2916
+
2917
+ it('should build video impression if video params are present in adunit.mediaTypes instead of bid.params', function() {
2918
+ let videoReq = [{
2919
+ 'bidder': 'pubmatic',
2920
+ 'params': {
2921
+ 'adSlot': 'SLOT_NHB1@728x90',
2922
+ 'publisherId': '5890',
2923
+ },
2924
+ 'mediaTypes': {
2925
+ 'video': {
2926
+ 'playerSize': [
2927
+ [640, 480]
2928
+ ],
2929
+ 'protocols': [1, 2, 5],
2930
+ 'context': 'instream',
2931
+ 'mimes': ['video/flv'],
2932
+ 'skip': 1,
2933
+ 'linearity': 2
2934
+ }
2935
+ },
2936
+ 'adUnitCode': 'video1',
2937
+ 'transactionId': 'adc36682-887c-41e9-9848-8b72c08332c0',
2938
+ 'sizes': [
2939
+ [640, 480]
2940
+ ],
2941
+ 'bidId': '21b59b1353ba82',
2942
+ 'bidderRequestId': '1a08245305e6dd',
2943
+ 'auctionId': 'bad3a743-7491-4d19-9a96-b0a69dd24a67',
2944
+ 'src': 'client',
2945
+ 'bidRequestsCount': 1,
2946
+ 'bidderRequestsCount': 1,
2947
+ 'bidderWinsCount': 0
2948
+ }]
2949
+ let request = spec.buildRequests(videoReq, {
2950
+ auctionId: 'new-auction-id'
2951
+ });
2952
+ let data = JSON.parse(request.data);
2953
+ data = data.imp[0];
2954
+ expect(data.video).to.exist;
2955
+ });
2956
+
2957
+ it('should build video impression with overwriting video params present in adunit.mediaTypes with bid.params', function() {
2958
+ let videoReq = [{
2959
+ 'bidder': 'pubmatic',
2960
+ 'params': {
2961
+ 'adSlot': 'SLOT_NHB1@728x90',
2962
+ 'publisherId': '5890',
2963
+ 'video': {
2964
+ 'mimes': ['video/mp4'],
2965
+ 'protocols': [1, 2, 5],
2966
+ 'linearity': 1
2967
+ }
2968
+ },
2969
+ 'mediaTypes': {
2970
+ 'video': {
2971
+ 'playerSize': [
2972
+ [640, 480]
2973
+ ],
2974
+ 'protocols': [1, 2, 5],
2975
+ 'context': 'instream',
2976
+ 'mimes': ['video/flv'],
2977
+ 'skip': 1,
2978
+ 'linearity': 2
2979
+ }
2980
+ },
2981
+ 'adUnitCode': 'video1',
2982
+ 'transactionId': 'adc36682-887c-41e9-9848-8b72c08332c0',
2983
+ 'sizes': [
2984
+ [640, 480]
2985
+ ],
2986
+ 'bidId': '21b59b1353ba82',
2987
+ 'bidderRequestId': '1a08245305e6dd',
2988
+ 'auctionId': 'bad3a743-7491-4d19-9a96-b0a69dd24a67',
2989
+ 'src': 'client',
2990
+ 'bidRequestsCount': 1,
2991
+ 'bidderRequestsCount': 1,
2992
+ 'bidderWinsCount': 0
2993
+ }]
2994
+ let request = spec.buildRequests(videoReq, {
2995
+ auctionId: 'new-auction-id'
2996
+ });
2997
+ let data = JSON.parse(request.data);
2998
+ data = data.imp[0];
2999
+
3000
+ expect(data.video).to.exist;
3001
+ expect(data.video.linearity).to.equal(1);
3002
+ });
3003
+
3004
+ it('Request params check for video ad', function () {
3005
+ let request = spec.buildRequests(videoBidRequests, {
3006
+ auctionId: 'new-auction-id'
3007
+ });
3008
+ let data = JSON.parse(request.data);
3009
+ expect(data.imp[0].video).to.exist;
3010
+ expect(data.imp[0].tagid).to.equal('Div1');
3011
+ expect(data.imp[0]['video']['mimes']).to.exist.and.to.be.an('array');
3012
+ expect(data.imp[0]['video']['mimes'][0]).to.equal(videoBidRequests[0].params.video['mimes'][0]);
3013
+ expect(data.imp[0]['video']['mimes'][1]).to.equal(videoBidRequests[0].params.video['mimes'][1]);
3014
+ expect(data.imp[0]['video']['minduration']).to.equal(videoBidRequests[0].params.video['minduration']);
3015
+ expect(data.imp[0]['video']['maxduration']).to.equal(videoBidRequests[0].params.video['maxduration']);
3016
+ expect(data.imp[0]['video']['startdelay']).to.equal(videoBidRequests[0].params.video['startdelay']);
3017
+
3018
+ expect(data.imp[0]['video']['playbackmethod']).to.exist.and.to.be.an('array');
3019
+ expect(data.imp[0]['video']['playbackmethod'][0]).to.equal(videoBidRequests[0].params.video['playbackmethod'][0]);
3020
+ expect(data.imp[0]['video']['playbackmethod'][1]).to.equal(videoBidRequests[0].params.video['playbackmethod'][1]);
3021
+
3022
+ expect(data.imp[0]['video']['api']).to.exist.and.to.be.an('array');
3023
+ expect(data.imp[0]['video']['api'][0]).to.equal(videoBidRequests[0].params.video['api'][0]);
3024
+ expect(data.imp[0]['video']['api'][1]).to.equal(videoBidRequests[0].params.video['api'][1]);
3025
+
3026
+ expect(data.imp[0]['video']['protocols']).to.exist.and.to.be.an('array');
3027
+ expect(data.imp[0]['video']['protocols'][0]).to.equal(videoBidRequests[0].params.video['protocols'][0]);
3028
+ expect(data.imp[0]['video']['protocols'][1]).to.equal(videoBidRequests[0].params.video['protocols'][1]);
3029
+
3030
+ expect(data.imp[0]['video']['battr']).to.exist.and.to.be.an('array');
3031
+ expect(data.imp[0]['video']['battr'][0]).to.equal(videoBidRequests[0].params.video['battr'][0]);
3032
+ expect(data.imp[0]['video']['battr'][1]).to.equal(videoBidRequests[0].params.video['battr'][1]);
3033
+
3034
+ expect(data.imp[0]['video']['linearity']).to.equal(videoBidRequests[0].params.video['linearity']);
3035
+ expect(data.imp[0]['video']['placement']).to.equal(videoBidRequests[0].params.video['placement']);
3036
+ expect(data.imp[0]['video']['minbitrate']).to.equal(videoBidRequests[0].params.video['minbitrate']);
3037
+ expect(data.imp[0]['video']['maxbitrate']).to.equal(videoBidRequests[0].params.video['maxbitrate']);
3038
+
3039
+ expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]);
3040
+ expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]);
3041
+ });
3042
+ }
3048
3043
  });
3049
3044
 
3050
3045
  it('Request params dctr check', function () {
@@ -3573,14 +3568,6 @@ describe('PubMatic adapter', function () {
3573
3568
  expect(response[0].mediaType).to.equal('banner');
3574
3569
  });
3575
3570
 
3576
- it('should check for valid video mediaType in case of multiformat request', function() {
3577
- let request = spec.buildRequests(videoBidRequests, {
3578
- auctionId: 'new-auction-id'
3579
- });
3580
- let response = spec.interpretResponse(videoBidResponse, request);
3581
- expect(response[0].mediaType).to.equal('video');
3582
- });
3583
-
3584
3571
  it('should check for valid native mediaType in case of multiformat request', function() {
3585
3572
  let request = spec.buildRequests(nativeBidRequests, {
3586
3573
  auctionId: 'new-auction-id'
@@ -3590,28 +3577,6 @@ describe('PubMatic adapter', function () {
3590
3577
  expect(response[0].mediaType).to.equal('native');
3591
3578
  });
3592
3579
 
3593
- it('should assign renderer if bid is video and request is for outstream', function() {
3594
- let request = spec.buildRequests(outstreamBidRequest, validOutstreamBidRequest);
3595
- let response = spec.interpretResponse(outstreamVideoBidResponse, request);
3596
- expect(response[0].renderer).to.exist;
3597
- });
3598
-
3599
- it('should not assign renderer if bidderRequest is not present', function() {
3600
- let request = spec.buildRequests(outstreamBidRequest, {
3601
- auctionId: 'new-auction-id'
3602
- });
3603
- let response = spec.interpretResponse(outstreamVideoBidResponse, request);
3604
- expect(response[0].renderer).to.not.exist;
3605
- });
3606
-
3607
- it('should not assign renderer if bid is video and request is for instream', function() {
3608
- let request = spec.buildRequests(videoBidRequests, {
3609
- auctionId: 'new-auction-id'
3610
- });
3611
- let response = spec.interpretResponse(videoBidResponse, request);
3612
- expect(response[0].renderer).to.not.exist;
3613
- });
3614
-
3615
3580
  it('should not assign renderer if bid is native', function() {
3616
3581
  let request = spec.buildRequests(nativeBidRequests, {
3617
3582
  auctionId: 'new-auction-id'
@@ -3628,154 +3593,186 @@ describe('PubMatic adapter', function () {
3628
3593
  expect(response[0].renderer).to.not.exist;
3629
3594
  });
3630
3595
 
3631
- it('should assign mediaType by reading bid.ext.mediaType', function() {
3632
- let newvideoRequests = [{
3633
- 'bidder': 'pubmatic',
3634
- 'params': {
3635
- 'adSlot': 'SLOT_NHB1@728x90',
3636
- 'publisherId': '5670',
3637
- 'video': {
3638
- 'mimes': ['video/mp4'],
3639
- 'skippable': true,
3640
- 'protocols': [1, 2, 5],
3641
- 'linearity': 1
3642
- }
3643
- },
3644
- 'mediaTypes': {
3645
- 'video': {
3646
- 'playerSize': [
3647
- [640, 480]
3648
- ],
3649
- 'protocols': [1, 2, 5],
3650
- 'context': 'instream',
3651
- 'mimes': ['video/flv'],
3652
- 'skippable': false,
3653
- 'skip': 1,
3654
- 'linearity': 2
3655
- }
3656
- },
3657
- 'adUnitCode': 'video1',
3658
- 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
3659
- 'sizes': [
3660
- [640, 480]
3661
- ],
3662
- 'bidId': '2c95df014cfe97',
3663
- 'bidderRequestId': '1fe59391566442',
3664
- 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
3665
- 'src': 'client',
3666
- 'bidRequestsCount': 1,
3667
- 'bidderRequestsCount': 1,
3668
- 'bidderWinsCount': 0
3669
- }];
3670
- let newvideoBidResponses = {
3671
- 'body': {
3672
- 'id': '1621441141473',
3673
- 'cur': 'USD',
3674
- 'customdata': 'openrtb1',
3675
- 'ext': {
3676
- 'buyid': 'myBuyId'
3596
+ if (FEATURES.VIDEO) {
3597
+ it('should check for valid video mediaType in case of multiformat request', function() {
3598
+ let request = spec.buildRequests(videoBidRequests, {
3599
+ auctionId: 'new-auction-id'
3600
+ });
3601
+ let response = spec.interpretResponse(videoBidResponse, request);
3602
+ expect(response[0].mediaType).to.equal('video');
3603
+ });
3604
+
3605
+ it('should assign renderer if bid is video and request is for outstream', function() {
3606
+ let request = spec.buildRequests(outstreamBidRequest, validOutstreamBidRequest);
3607
+ let response = spec.interpretResponse(outstreamVideoBidResponse, request);
3608
+ expect(response[0].renderer).to.exist;
3609
+ });
3610
+
3611
+ it('should not assign renderer if bidderRequest is not present', function() {
3612
+ let request = spec.buildRequests(outstreamBidRequest, {
3613
+ auctionId: 'new-auction-id'
3614
+ });
3615
+ let response = spec.interpretResponse(outstreamVideoBidResponse, request);
3616
+ expect(response[0].renderer).to.not.exist;
3617
+ });
3618
+
3619
+ it('should not assign renderer if bid is video and request is for instream', function() {
3620
+ let request = spec.buildRequests(videoBidRequests, {
3621
+ auctionId: 'new-auction-id'
3622
+ });
3623
+ let response = spec.interpretResponse(videoBidResponse, request);
3624
+ expect(response[0].renderer).to.not.exist;
3625
+ });
3626
+
3627
+ it('should assign mediaType by reading bid.ext.mediaType', function() {
3628
+ let newvideoRequests = [{
3629
+ 'bidder': 'pubmatic',
3630
+ 'params': {
3631
+ 'adSlot': 'SLOT_NHB1@728x90',
3632
+ 'publisherId': '5670',
3633
+ 'video': {
3634
+ 'mimes': ['video/mp4'],
3635
+ 'skippable': true,
3636
+ 'protocols': [1, 2, 5],
3637
+ 'linearity': 1
3638
+ }
3677
3639
  },
3678
- 'seatbid': [{
3679
- 'bid': [{
3680
- 'id': '2c95df014cfe97',
3681
- 'impid': '2c95df014cfe97',
3682
- 'price': 4.2,
3683
- 'cid': 'test1',
3684
- 'crid': 'test2',
3685
- 'adm': "<VAST version='3.0'><Ad id='601364'><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Creatives><Creative AdID='601364'><Linear skipoffset='20%'><TrackingEvents><Tracking event='close'><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event='skip'><![CDATA[https://mytracking.com/linear/skip]]></Tracking><MediaFiles><MediaFile delivery='progressive' type='video/mp4' bitrate='500' width='400' height='300' scalable='true' maintainAspectRatio='true'><![CDATA[https://localhost/pubmatic.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>",
3686
- 'w': 0,
3687
- 'h': 0,
3688
- 'dealId': 'ASEA-MS-KLY-TTD-DESKTOP-ID-VID-6S-030420',
3689
- 'ext': {
3690
- 'bidtype': 1
3691
- }
3692
- }],
3640
+ 'mediaTypes': {
3641
+ 'video': {
3642
+ 'playerSize': [
3643
+ [640, 480]
3644
+ ],
3645
+ 'protocols': [1, 2, 5],
3646
+ 'context': 'instream',
3647
+ 'mimes': ['video/flv'],
3648
+ 'skippable': false,
3649
+ 'skip': 1,
3650
+ 'linearity': 2
3651
+ }
3652
+ },
3653
+ 'adUnitCode': 'video1',
3654
+ 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
3655
+ 'sizes': [
3656
+ [640, 480]
3657
+ ],
3658
+ 'bidId': '2c95df014cfe97',
3659
+ 'bidderRequestId': '1fe59391566442',
3660
+ 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
3661
+ 'src': 'client',
3662
+ 'bidRequestsCount': 1,
3663
+ 'bidderRequestsCount': 1,
3664
+ 'bidderWinsCount': 0
3665
+ }];
3666
+ let newvideoBidResponses = {
3667
+ 'body': {
3668
+ 'id': '1621441141473',
3669
+ 'cur': 'USD',
3670
+ 'customdata': 'openrtb1',
3693
3671
  'ext': {
3694
3672
  'buyid': 'myBuyId'
3695
- }
3696
- }]
3697
- },
3698
- 'headers': {}
3699
- }
3700
- let newrequest = spec.buildRequests(newvideoRequests, {
3701
- auctionId: 'new-auction-id'
3702
- });
3703
- let newresponse = spec.interpretResponse(newvideoBidResponses, newrequest);
3704
- expect(newresponse[0].mediaType).to.equal('video')
3705
- })
3673
+ },
3674
+ 'seatbid': [{
3675
+ 'bid': [{
3676
+ 'id': '2c95df014cfe97',
3677
+ 'impid': '2c95df014cfe97',
3678
+ 'price': 4.2,
3679
+ 'cid': 'test1',
3680
+ 'crid': 'test2',
3681
+ 'adm': "<VAST version='3.0'><Ad id='601364'><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Creatives><Creative AdID='601364'><Linear skipoffset='20%'><TrackingEvents><Tracking event='close'><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event='skip'><![CDATA[https://mytracking.com/linear/skip]]></Tracking><MediaFiles><MediaFile delivery='progressive' type='video/mp4' bitrate='500' width='400' height='300' scalable='true' maintainAspectRatio='true'><![CDATA[https://localhost/pubmatic.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>",
3682
+ 'w': 0,
3683
+ 'h': 0,
3684
+ 'dealId': 'ASEA-MS-KLY-TTD-DESKTOP-ID-VID-6S-030420',
3685
+ 'ext': {
3686
+ 'bidtype': 1
3687
+ }
3688
+ }],
3689
+ 'ext': {
3690
+ 'buyid': 'myBuyId'
3691
+ }
3692
+ }]
3693
+ },
3694
+ 'headers': {}
3695
+ }
3696
+ let newrequest = spec.buildRequests(newvideoRequests, {
3697
+ auctionId: 'new-auction-id'
3698
+ });
3699
+ let newresponse = spec.interpretResponse(newvideoBidResponses, newrequest);
3700
+ expect(newresponse[0].mediaType).to.equal('video')
3701
+ })
3706
3702
 
3707
- it('should assign mediaType even if bid.ext.mediaType does not exists', function() {
3708
- let newvideoRequests = [{
3709
- 'bidder': 'pubmatic',
3710
- 'params': {
3711
- 'adSlot': 'SLOT_NHB1@728x90',
3712
- 'publisherId': '5670',
3713
- 'video': {
3714
- 'mimes': ['video/mp4'],
3715
- 'skippable': true,
3716
- 'protocols': [1, 2, 5],
3717
- 'linearity': 1
3718
- }
3719
- },
3720
- 'mediaTypes': {
3721
- 'video': {
3722
- 'playerSize': [
3723
- [640, 480]
3724
- ],
3725
- 'protocols': [1, 2, 5],
3726
- 'context': 'instream',
3727
- 'mimes': ['video/flv'],
3728
- 'skippable': false,
3729
- 'skip': 1,
3730
- 'linearity': 2
3731
- }
3732
- },
3733
- 'adUnitCode': 'video1',
3734
- 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
3735
- 'sizes': [
3736
- [640, 480]
3737
- ],
3738
- 'bidId': '2c95df014cfe97',
3739
- 'bidderRequestId': '1fe59391566442',
3740
- 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
3741
- 'src': 'client',
3742
- 'bidRequestsCount': 1,
3743
- 'bidderRequestsCount': 1,
3744
- 'bidderWinsCount': 0
3745
- }];
3746
- let newvideoBidResponses = {
3747
- 'body': {
3748
- 'id': '1621441141473',
3749
- 'cur': 'USD',
3750
- 'customdata': 'openrtb1',
3751
- 'ext': {
3752
- 'buyid': 'myBuyId'
3703
+ it('should assign mediaType even if bid.ext.mediaType does not exists', function() {
3704
+ let newvideoRequests = [{
3705
+ 'bidder': 'pubmatic',
3706
+ 'params': {
3707
+ 'adSlot': 'SLOT_NHB1@728x90',
3708
+ 'publisherId': '5670',
3709
+ 'video': {
3710
+ 'mimes': ['video/mp4'],
3711
+ 'skippable': true,
3712
+ 'protocols': [1, 2, 5],
3713
+ 'linearity': 1
3714
+ }
3753
3715
  },
3754
- 'seatbid': [{
3755
- 'bid': [{
3756
- 'id': '2c95df014cfe97',
3757
- 'impid': '2c95df014cfe97',
3758
- 'price': 4.2,
3759
- 'cid': 'test1',
3760
- 'crid': 'test2',
3761
- 'adm': "<VAST version='3.0'><Ad id='601364'><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Creatives><Creative AdID='601364'><Linear skipoffset='20%'><TrackingEvents><Tracking event='close'><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event='skip'><![CDATA[https://mytracking.com/linear/skip]]></Tracking><MediaFiles><MediaFile delivery='progressive' type='video/mp4' bitrate='500' width='400' height='300' scalable='true' maintainAspectRatio='true'><![CDATA[https://localhost/pubmatic.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>",
3762
- 'w': 0,
3763
- 'h': 0,
3764
- 'dealId': 'ASEA-MS-KLY-TTD-DESKTOP-ID-VID-6S-030420'
3765
- }],
3716
+ 'mediaTypes': {
3717
+ 'video': {
3718
+ 'playerSize': [
3719
+ [640, 480]
3720
+ ],
3721
+ 'protocols': [1, 2, 5],
3722
+ 'context': 'instream',
3723
+ 'mimes': ['video/flv'],
3724
+ 'skippable': false,
3725
+ 'skip': 1,
3726
+ 'linearity': 2
3727
+ }
3728
+ },
3729
+ 'adUnitCode': 'video1',
3730
+ 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf',
3731
+ 'sizes': [
3732
+ [640, 480]
3733
+ ],
3734
+ 'bidId': '2c95df014cfe97',
3735
+ 'bidderRequestId': '1fe59391566442',
3736
+ 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142',
3737
+ 'src': 'client',
3738
+ 'bidRequestsCount': 1,
3739
+ 'bidderRequestsCount': 1,
3740
+ 'bidderWinsCount': 0
3741
+ }];
3742
+ let newvideoBidResponses = {
3743
+ 'body': {
3744
+ 'id': '1621441141473',
3745
+ 'cur': 'USD',
3746
+ 'customdata': 'openrtb1',
3766
3747
  'ext': {
3767
3748
  'buyid': 'myBuyId'
3768
- }
3769
- }]
3770
- },
3771
- 'headers': {}
3772
- }
3773
- let newrequest = spec.buildRequests(newvideoRequests, {
3774
- auctionId: 'new-auction-id'
3749
+ },
3750
+ 'seatbid': [{
3751
+ 'bid': [{
3752
+ 'id': '2c95df014cfe97',
3753
+ 'impid': '2c95df014cfe97',
3754
+ 'price': 4.2,
3755
+ 'cid': 'test1',
3756
+ 'crid': 'test2',
3757
+ 'adm': "<VAST version='3.0'><Ad id='601364'><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Creatives><Creative AdID='601364'><Linear skipoffset='20%'><TrackingEvents><Tracking event='close'><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event='skip'><![CDATA[https://mytracking.com/linear/skip]]></Tracking><MediaFiles><MediaFile delivery='progressive' type='video/mp4' bitrate='500' width='400' height='300' scalable='true' maintainAspectRatio='true'><![CDATA[https://localhost/pubmatic.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>",
3758
+ 'w': 0,
3759
+ 'h': 0,
3760
+ 'dealId': 'ASEA-MS-KLY-TTD-DESKTOP-ID-VID-6S-030420'
3761
+ }],
3762
+ 'ext': {
3763
+ 'buyid': 'myBuyId'
3764
+ }
3765
+ }]
3766
+ },
3767
+ 'headers': {}
3768
+ }
3769
+ let newrequest = spec.buildRequests(newvideoRequests, {
3770
+ auctionId: 'new-auction-id'
3771
+ });
3772
+ let newresponse = spec.interpretResponse(newvideoBidResponses, newrequest);
3773
+ expect(newresponse[0].mediaType).to.equal('video')
3775
3774
  });
3776
- let newresponse = spec.interpretResponse(newvideoBidResponses, newrequest);
3777
- expect(newresponse[0].mediaType).to.equal('video')
3778
- });
3775
+ }
3779
3776
  });
3780
3777
 
3781
3778
  describe('Preapare metadata', function () {
@@ -3955,26 +3952,55 @@ describe('PubMatic adapter', function () {
3955
3952
  });
3956
3953
  });
3957
3954
 
3958
- describe('Checking for Video.Placement property', function() {
3959
- let sandbox, utilsMock;
3960
- const adUnit = 'Div1';
3961
- const msg_placement_missing = 'Video.Placement param missing for Div1';
3962
- let videoData = {
3963
- battr: [6, 7],
3964
- skipafter: 15,
3965
- maxduration: 50,
3966
- context: 'instream',
3967
- playerSize: [640, 480],
3968
- skip: 0,
3969
- connectiontype: [1, 2, 6],
3970
- skipmin: 10,
3971
- minduration: 10,
3972
- mimes: ['video/mp4', 'video/x-flv'],
3973
- }
3955
+ if (FEATURES.VIDEO) {
3956
+ describe('Checking for Video.Placement property', function() {
3957
+ let sandbox, utilsMock;
3958
+ const adUnit = 'Div1';
3959
+ const msg_placement_missing = 'Video.Placement param missing for Div1';
3960
+ let videoData = {
3961
+ battr: [6, 7],
3962
+ skipafter: 15,
3963
+ maxduration: 50,
3964
+ context: 'instream',
3965
+ playerSize: [640, 480],
3966
+ skip: 0,
3967
+ connectiontype: [1, 2, 6],
3968
+ skipmin: 10,
3969
+ minduration: 10,
3970
+ mimes: ['video/mp4', 'video/x-flv'],
3971
+ }
3972
+ beforeEach(() => {
3973
+ utilsMock = sinon.mock(utils);
3974
+ sandbox = sinon.sandbox.create();
3975
+ sandbox.spy(utils, 'logWarn');
3976
+ });
3977
+
3978
+ afterEach(() => {
3979
+ utilsMock.restore();
3980
+ sandbox.restore();
3981
+ })
3982
+
3983
+ it('should log Video.Placement param missing', function() {
3984
+ checkVideoPlacement(videoData, adUnit);
3985
+ sinon.assert.calledWith(utils.logWarn, msg_placement_missing);
3986
+ })
3987
+ it('shoud not log Video.Placement param missing', function() {
3988
+ videoData['placement'] = 1;
3989
+ checkVideoPlacement(videoData, adUnit);
3990
+ sinon.assert.neverCalledWith(utils.logWarn, msg_placement_missing);
3991
+ })
3992
+ });
3993
+ }
3994
+ });
3995
+
3996
+ if (FEATURES.VIDEO) {
3997
+ describe('Video request params', function() {
3998
+ let sandbox, utilsMock, newVideoRequest;
3974
3999
  beforeEach(() => {
3975
4000
  utilsMock = sinon.mock(utils);
3976
4001
  sandbox = sinon.sandbox.create();
3977
4002
  sandbox.spy(utils, 'logWarn');
4003
+ newVideoRequest = utils.deepClone(videoBidRequests)
3978
4004
  });
3979
4005
 
3980
4006
  afterEach(() => {
@@ -3982,112 +4008,87 @@ describe('PubMatic adapter', function () {
3982
4008
  sandbox.restore();
3983
4009
  })
3984
4010
 
3985
- it('should log Video.Placement param missing', function() {
3986
- checkVideoPlacement(videoData, adUnit);
3987
- sinon.assert.calledWith(utils.logWarn, msg_placement_missing);
3988
- })
3989
- it('shoud not log Video.Placement param missing', function() {
3990
- videoData['placement'] = 1;
3991
- checkVideoPlacement(videoData, adUnit);
3992
- sinon.assert.neverCalledWith(utils.logWarn, msg_placement_missing);
3993
- })
3994
- });
3995
- });
4011
+ it('Should log warning if video params from mediaTypes and params obj of bid are not present', function () {
4012
+ delete newVideoRequest[0].mediaTypes.video;
4013
+ delete newVideoRequest[0].params.video;
3996
4014
 
3997
- describe('Video request params', function() {
3998
- let sandbox, utilsMock, newVideoRequest;
3999
- beforeEach(() => {
4000
- utilsMock = sinon.mock(utils);
4001
- sandbox = sinon.sandbox.create();
4002
- sandbox.spy(utils, 'logWarn');
4003
- newVideoRequest = utils.deepClone(videoBidRequests)
4004
- });
4005
-
4006
- afterEach(() => {
4007
- utilsMock.restore();
4008
- sandbox.restore();
4009
- })
4010
-
4011
- it('Should log warning if video params from mediaTypes and params obj of bid are not present', function () {
4012
- delete newVideoRequest[0].mediaTypes.video;
4013
- delete newVideoRequest[0].params.video;
4015
+ let request = spec.buildRequests(newVideoRequest, {
4016
+ auctionId: 'new-auction-id'
4017
+ });
4014
4018
 
4015
- let request = spec.buildRequests(newVideoRequest, {
4016
- auctionId: 'new-auction-id'
4019
+ sinon.assert.calledOnce(utils.logWarn);
4020
+ expect(request).to.equal(undefined);
4017
4021
  });
4018
4022
 
4019
- sinon.assert.calledOnce(utils.logWarn);
4020
- expect(request).to.equal(undefined);
4021
- });
4022
-
4023
- it('Should consider video params from mediaType object of bid', function () {
4024
- delete newVideoRequest[0].params.video;
4023
+ it('Should consider video params from mediaType object of bid', function () {
4024
+ delete newVideoRequest[0].params.video;
4025
4025
 
4026
- let request = spec.buildRequests(newVideoRequest, {
4027
- auctionId: 'new-auction-id'
4028
- });
4029
- let data = JSON.parse(request.data);
4030
- expect(data.imp[0].video).to.exist;
4031
- expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]);
4032
- expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]);
4033
- expect(data.imp[0]['video']['battr']).to.equal(undefined);
4034
- });
4035
-
4036
- describe('Assign Deal Tier (i.e. prebidDealPriority)', function () {
4037
- let videoSeatBid, request, newBid;
4038
- // let data = JSON.parse(request.data);
4039
- beforeEach(function () {
4040
- videoSeatBid = videoBidResponse.body.seatbid[0].bid[0];
4041
- // const adpodValidOutstreamBidRequest = validOutstreamBidRequest.bids[0].mediaTypes.video.context = 'adpod';
4042
- request = spec.buildRequests(bidRequests, validOutstreamBidRequest);
4043
- newBid = {
4044
- requestId: '47acc48ad47af5'
4045
- };
4046
- videoSeatBid.ext = videoSeatBid.ext || {};
4047
- videoSeatBid.ext.video = videoSeatBid.ext.video || {};
4048
- // videoBidRequests[0].mediaTypes.video = videoBidRequests[0].mediaTypes.video || {};
4049
- });
4050
-
4051
- it('should not assign video object if deal priority is missing', function () {
4052
- assignDealTier(newBid, videoSeatBid, request);
4053
- expect(newBid.video).to.equal(undefined);
4054
- expect(newBid.video).to.not.exist;
4055
- });
4056
-
4057
- it('should not assign video object if context is not a adpod', function () {
4058
- videoSeatBid.ext.prebiddealpriority = 5;
4059
- assignDealTier(newBid, videoSeatBid, request);
4060
- expect(newBid.video).to.equal(undefined);
4061
- expect(newBid.video).to.not.exist;
4026
+ let request = spec.buildRequests(newVideoRequest, {
4027
+ auctionId: 'new-auction-id'
4028
+ });
4029
+ let data = JSON.parse(request.data);
4030
+ expect(data.imp[0].video).to.exist;
4031
+ expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]);
4032
+ expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]);
4033
+ expect(data.imp[0]['video']['battr']).to.equal(undefined);
4062
4034
  });
4063
4035
 
4064
- describe('when video deal tier object is present', function () {
4036
+ describe('Assign Deal Tier (i.e. prebidDealPriority)', function () {
4037
+ let videoSeatBid, request, newBid;
4038
+ // let data = JSON.parse(request.data);
4065
4039
  beforeEach(function () {
4066
- videoSeatBid.ext.prebiddealpriority = 5;
4067
- request.bidderRequest.bids[0].mediaTypes.video = {
4068
- ...request.bidderRequest.bids[0].mediaTypes.video,
4069
- context: 'adpod',
4070
- maxduration: 50
4040
+ videoSeatBid = videoBidResponse.body.seatbid[0].bid[0];
4041
+ // const adpodValidOutstreamBidRequest = validOutstreamBidRequest.bids[0].mediaTypes.video.context = 'adpod';
4042
+ request = spec.buildRequests(bidRequests, validOutstreamBidRequest);
4043
+ newBid = {
4044
+ requestId: '47acc48ad47af5'
4071
4045
  };
4046
+ videoSeatBid.ext = videoSeatBid.ext || {};
4047
+ videoSeatBid.ext.video = videoSeatBid.ext.video || {};
4048
+ // videoBidRequests[0].mediaTypes.video = videoBidRequests[0].mediaTypes.video || {};
4072
4049
  });
4073
4050
 
4074
- it('should set video deal tier object, when maxduration is present in ext', function () {
4051
+ it('should not assign video object if deal priority is missing', function () {
4075
4052
  assignDealTier(newBid, videoSeatBid, request);
4076
- expect(newBid.video.durationSeconds).to.equal(50);
4077
- expect(newBid.video.context).to.equal('adpod');
4078
- expect(newBid.video.dealTier).to.equal(5);
4053
+ expect(newBid.video).to.equal(undefined);
4054
+ expect(newBid.video).to.not.exist;
4079
4055
  });
4080
4056
 
4081
- it('should set video deal tier object, when duration is present in ext', function () {
4082
- videoSeatBid.ext.video.duration = 20;
4057
+ it('should not assign video object if context is not a adpod', function () {
4058
+ videoSeatBid.ext.prebiddealpriority = 5;
4083
4059
  assignDealTier(newBid, videoSeatBid, request);
4084
- expect(newBid.video.durationSeconds).to.equal(20);
4085
- expect(newBid.video.context).to.equal('adpod');
4086
- expect(newBid.video.dealTier).to.equal(5);
4060
+ expect(newBid.video).to.equal(undefined);
4061
+ expect(newBid.video).to.not.exist;
4062
+ });
4063
+
4064
+ describe('when video deal tier object is present', function () {
4065
+ beforeEach(function () {
4066
+ videoSeatBid.ext.prebiddealpriority = 5;
4067
+ request.bidderRequest.bids[0].mediaTypes.video = {
4068
+ ...request.bidderRequest.bids[0].mediaTypes.video,
4069
+ context: 'adpod',
4070
+ maxduration: 50
4071
+ };
4072
+ });
4073
+
4074
+ it('should set video deal tier object, when maxduration is present in ext', function () {
4075
+ assignDealTier(newBid, videoSeatBid, request);
4076
+ expect(newBid.video.durationSeconds).to.equal(50);
4077
+ expect(newBid.video.context).to.equal('adpod');
4078
+ expect(newBid.video.dealTier).to.equal(5);
4079
+ });
4080
+
4081
+ it('should set video deal tier object, when duration is present in ext', function () {
4082
+ videoSeatBid.ext.video.duration = 20;
4083
+ assignDealTier(newBid, videoSeatBid, request);
4084
+ expect(newBid.video.durationSeconds).to.equal(20);
4085
+ expect(newBid.video.context).to.equal('adpod');
4086
+ expect(newBid.video.dealTier).to.equal(5);
4087
+ });
4087
4088
  });
4088
4089
  });
4089
4090
  });
4090
- });
4091
+ }
4091
4092
 
4092
4093
  describe('Marketplace params', function () {
4093
4094
  let sandbox, utilsMock, newBidRequests, newBidResponses;