prebid.js 7.3.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/.circleci/config.yml +11 -6
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adnuntiusBidAdapter.js +1 -1
  7. package/dist/adotBidAdapter.js +1 -1
  8. package/dist/adpod.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adrinoBidAdapter.js +1 -1
  11. package/dist/adtelligentBidAdapter.js +1 -1
  12. package/dist/adxcgBidAdapter.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/asoBidAdapter.js +1 -1
  19. package/dist/atsAnalyticsAdapter.js +1 -1
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/bidglassBidAdapter.js +1 -1
  22. package/dist/big-richmediaBidAdapter.js +1 -1
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/byDataAnalyticsAdapter.js +1 -1
  26. package/dist/concertBidAdapter.js +1 -1
  27. package/dist/connectadBidAdapter.js +1 -1
  28. package/dist/consumableBidAdapter.js +1 -1
  29. package/dist/conversantBidAdapter.js +1 -1
  30. package/dist/craftBidAdapter.js +1 -1
  31. package/dist/criteoBidAdapter.js +1 -1
  32. package/dist/debugging-standalone.js +1 -1
  33. package/dist/debugging.js +1 -1
  34. package/dist/dspxBidAdapter.js +1 -1
  35. package/dist/eplanningBidAdapter.js +1 -1
  36. package/dist/finativeBidAdapter.js +1 -1
  37. package/dist/gdprEnforcement.js +1 -1
  38. package/dist/glimpseBidAdapter.js +1 -1
  39. package/dist/gmosspBidAdapter.js +1 -1
  40. package/dist/goldbachBidAdapter.js +1 -1
  41. package/dist/gridBidAdapter.js +1 -1
  42. package/dist/gridNMBidAdapter.js +1 -1
  43. package/dist/gumgumBidAdapter.js +1 -1
  44. package/dist/h12mediaBidAdapter.js +1 -1
  45. package/dist/hadronIdSystem.js +1 -1
  46. package/dist/hadronRtdProvider.js +1 -1
  47. package/dist/id5IdSystem.js +1 -1
  48. package/dist/imRtdProvider.js +1 -1
  49. package/dist/improvedigitalBidAdapter.js +1 -1
  50. package/dist/inmarBidAdapter.js +1 -1
  51. package/dist/insticatorBidAdapter.js +1 -1
  52. package/dist/ixBidAdapter.js +1 -1
  53. package/dist/justpremiumBidAdapter.js +1 -1
  54. package/dist/kargoAnalyticsAdapter.js +1 -1
  55. package/dist/kargoBidAdapter.js +1 -1
  56. package/dist/konduitAnalyticsAdapter.js +1 -1
  57. package/dist/kueezBidAdapter.js +1 -1
  58. package/dist/lassoBidAdapter.js +1 -1
  59. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  60. package/dist/logicadBidAdapter.js +1 -1
  61. package/dist/loglyliftBidAdapter.js +1 -1
  62. package/dist/malltvAnalyticsAdapter.js +1 -1
  63. package/dist/marsmediaBidAdapter.js +1 -1
  64. package/dist/mediafuseBidAdapter.js +1 -1
  65. package/dist/mediasquareBidAdapter.js +1 -1
  66. package/dist/mgidBidAdapter.js +1 -1
  67. package/dist/minutemediaBidAdapter.js +1 -1
  68. package/dist/missenaBidAdapter.js +1 -1
  69. package/dist/newspassidBidAdapter.js +1 -0
  70. package/dist/nextMillenniumBidAdapter.js +1 -1
  71. package/dist/not-for-prod/prebid.js +131 -127
  72. package/dist/oguryBidAdapter.js +1 -1
  73. package/dist/onetagBidAdapter.js +1 -1
  74. package/dist/ooloAnalyticsAdapter.js +1 -1
  75. package/dist/openxOrtbBidAdapter.js +1 -0
  76. package/dist/outbrainBidAdapter.js +1 -1
  77. package/dist/parrableIdSystem.js +1 -1
  78. package/dist/pixfutureBidAdapter.js +1 -1
  79. package/dist/prebid-core.js +2 -2
  80. package/dist/priceFloors.js +1 -1
  81. package/dist/pubCommonId.js +1 -1
  82. package/dist/publinkIdSystem.js +1 -1
  83. package/dist/pubmaticBidAdapter.js +1 -1
  84. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  85. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  86. package/dist/pxyzBidAdapter.js +1 -1
  87. package/dist/quantcastBidAdapter.js +1 -1
  88. package/dist/rasBidAdapter.js +1 -0
  89. package/dist/readpeakBidAdapter.js +1 -1
  90. package/dist/relaidoBidAdapter.js +1 -1
  91. package/dist/rhythmoneBidAdapter.js +1 -1
  92. package/dist/riseBidAdapter.js +1 -1
  93. package/dist/rubiconAnalyticsAdapter.js +1 -1
  94. package/dist/rubiconBidAdapter.js +1 -1
  95. package/dist/seedingAllianceBidAdapter.js +1 -1
  96. package/dist/seedtagBidAdapter.js +1 -1
  97. package/dist/sharedIdSystem.js +1 -1
  98. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  99. package/dist/sharethroughBidAdapter.js +1 -1
  100. package/dist/shinezBidAdapter.js +1 -0
  101. package/dist/sizeMappingV2.js +1 -1
  102. package/dist/smaatoBidAdapter.js +1 -1
  103. package/dist/smartadserverBidAdapter.js +1 -1
  104. package/dist/smartxBidAdapter.js +1 -1
  105. package/dist/smilewantedBidAdapter.js +1 -1
  106. package/dist/sonobiBidAdapter.js +1 -1
  107. package/dist/sovrnAnalyticsAdapter.js +1 -1
  108. package/dist/sovrnBidAdapter.js +1 -1
  109. package/dist/sspBCBidAdapter.js +1 -1
  110. package/dist/sublimeBidAdapter.js +1 -1
  111. package/dist/synacormediaBidAdapter.js +1 -1
  112. package/dist/taboolaBidAdapter.js +1 -1
  113. package/dist/targetVideoBidAdapter.js +1 -1
  114. package/dist/teadsBidAdapter.js +1 -1
  115. package/dist/trionBidAdapter.js +1 -1
  116. package/dist/tripleliftBidAdapter.js +1 -1
  117. package/dist/ttdBidAdapter.js +1 -1
  118. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  119. package/dist/underdogmediaBidAdapter.js +1 -1
  120. package/dist/undertoneBidAdapter.js +1 -1
  121. package/dist/ventesBidAdapter.js +1 -1
  122. package/dist/vidazooBidAdapter.js +1 -1
  123. package/dist/videobyteBidAdapter.js +1 -1
  124. package/dist/visxBidAdapter.js +1 -1
  125. package/dist/vrtcalBidAdapter.js +1 -1
  126. package/dist/vuukleBidAdapter.js +1 -1
  127. package/dist/widespaceBidAdapter.js +1 -1
  128. package/dist/winrBidAdapter.js +1 -1
  129. package/dist/yahoosspBidAdapter.js +1 -1
  130. package/dist/yieldmoBidAdapter.js +1 -1
  131. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  132. package/gulpfile.js +1 -1
  133. package/karma.conf.maker.js +3 -1
  134. package/modules/adgenerationBidAdapter.js +24 -1
  135. package/modules/adnuntiusBidAdapter.js +26 -8
  136. package/modules/adotBidAdapter.js +13 -4
  137. package/modules/adrinoBidAdapter.js +10 -2
  138. package/modules/adrinoBidAdapter.md +6 -0
  139. package/modules/adtelligentBidAdapter.js +2 -1
  140. package/modules/appnexusBidAdapter.js +3 -3
  141. package/modules/atsAnalyticsAdapter.js +4 -5
  142. package/modules/byDataAnalyticsAdapter.js +172 -74
  143. package/modules/byDataAnalyticsAdapter.md +5 -6
  144. package/modules/consumableBidAdapter.js +12 -1
  145. package/modules/criteoBidAdapter.js +7 -1
  146. package/modules/cwireBidAdapter.md +1 -1
  147. package/modules/debugging/bidInterceptor.js +1 -1
  148. package/modules/debugging/index.js +2 -1
  149. package/modules/eplanningBidAdapter.js +82 -97
  150. package/modules/gdprEnforcement.js +8 -14
  151. package/modules/gridNMBidAdapter.js +45 -4
  152. package/modules/hadronAnalyticsAdapter.md +5 -5
  153. package/modules/hadronIdSystem.js +18 -5
  154. package/modules/hadronIdSystem.md +15 -11
  155. package/modules/hadronRtdProvider.js +14 -1
  156. package/modules/hadronRtdProvider.md +17 -13
  157. package/modules/imRtdProvider.js +0 -8
  158. package/modules/insticatorBidAdapter.js +9 -0
  159. package/modules/ixBidAdapter.js +462 -58
  160. package/modules/ixBidAdapter.md +95 -5
  161. package/modules/kargoAnalyticsAdapter.js +88 -6
  162. package/modules/kargoAnalyticsAdapter.md +33 -0
  163. package/modules/kargoBidAdapter.js +1 -2
  164. package/modules/minutemediaBidAdapter.js +1 -0
  165. package/modules/missenaBidAdapter.js +20 -2
  166. package/modules/newspassidBidAdapter.js +649 -0
  167. package/modules/nextMillenniumBidAdapter.js +17 -1
  168. package/modules/oguryBidAdapter.js +2 -0
  169. package/modules/openxBidAdapter.md +3 -1
  170. package/modules/openxOrtbBidAdapter.js +349 -0
  171. package/modules/openxOrtbBidAdapter.md +105 -0
  172. package/modules/priceFloors.js +1 -1
  173. package/modules/pubCommonId.js +1 -2
  174. package/modules/pubxaiAnalyticsAdapter.js +6 -1
  175. package/modules/rasBidAdapter.js +149 -0
  176. package/modules/rasBidAdapter.md +50 -0
  177. package/modules/readpeakBidAdapter.js +15 -6
  178. package/modules/relaidoBidAdapter.js +19 -4
  179. package/modules/seedtagBidAdapter.js +37 -1
  180. package/modules/sharedIdSystem.js +11 -5
  181. package/modules/sharethroughBidAdapter.js +9 -24
  182. package/modules/shinezBidAdapter.js +435 -0
  183. package/modules/shinezBidAdapter.md +76 -0
  184. package/modules/taboolaBidAdapter.js +1 -1
  185. package/modules/taboolaBidAdapter.md +3 -3
  186. package/modules/ventesBidAdapter.js +1 -1
  187. package/modules/ventesBidAdapter.md +1 -1
  188. package/modules/vrtcalBidAdapter.js +35 -0
  189. package/package.json +1 -1
  190. package/plugins/pbjsGlobals.js +2 -1
  191. package/src/storageManager.js +4 -5
  192. package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -4
  193. package/test/spec/modules/adnuntiusBidAdapter_spec.js +126 -14
  194. package/test/spec/modules/adotBidAdapter_spec.js +12 -9
  195. package/test/spec/modules/adrinoBidAdapter_spec.js +22 -0
  196. package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
  197. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +74 -24
  198. package/test/spec/modules/consumableBidAdapter_spec.js +75 -0
  199. package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
  200. package/test/spec/modules/debugging_mod_spec.js +7 -0
  201. package/test/spec/modules/eplanningBidAdapter_spec.js +58 -18
  202. package/test/spec/modules/gdprEnforcement_spec.js +53 -100
  203. package/test/spec/modules/gridNMBidAdapter_spec.js +32 -0
  204. package/test/spec/modules/hadronIdSystem_spec.js +2 -2
  205. package/test/spec/modules/imRtdProvider_spec.js +0 -1
  206. package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
  207. package/test/spec/modules/ixBidAdapter_spec.js +470 -10
  208. package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
  209. package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
  210. package/test/spec/modules/minutemediaBidAdapter_spec.js +3 -0
  211. package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
  212. package/test/spec/modules/newspassidBidAdapter_spec.js +1793 -0
  213. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +20 -0
  214. package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
  215. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +5 -0
  216. package/test/spec/modules/rasBidAdapter_spec.js +190 -0
  217. package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
  218. package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
  219. package/test/spec/modules/seedtagBidAdapter_spec.js +29 -0
  220. package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
  221. package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
  222. package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
  223. package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
  224. package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
  225. package/webpack.conf.js +1 -1
@@ -0,0 +1,1793 @@
1
+ import { expect } from 'chai';
2
+ import { spec, defaultSize } from 'modules/newspassidBidAdapter.js';
3
+ import { config } from 'src/config.js';
4
+ import {getGranularityKeyName, getGranularityObject} from '../../../modules/newspassidBidAdapter.js';
5
+ import * as utils from '../../../src/utils.js';
6
+ const NEWSPASSURI = 'https://bidder.newspassid.com/openrtb2/auction';
7
+ const BIDDER_CODE = 'newspassid';
8
+ var validBidRequests = [
9
+ {
10
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
11
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
12
+ bidId: '2899ec066a91ff8',
13
+ bidRequestsCount: 1,
14
+ bidder: 'newspassid',
15
+ bidderRequestId: '1c1586b27a1b5c8',
16
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
17
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
18
+ sizes: [[300, 250], [300, 600]],
19
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
20
+ }
21
+ ];
22
+ var validBidRequestsNoCustomData = [
23
+ {
24
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
25
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
26
+ bidId: '2899ec066a91ff8',
27
+ bidRequestsCount: 1,
28
+ bidder: 'newspassid',
29
+ bidderRequestId: '1c1586b27a1b5c8',
30
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
31
+ params: { publisherId: '9876abcd12-3', placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
32
+ sizes: [[300, 250], [300, 600]],
33
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
34
+ }
35
+ ];
36
+ var validBidRequestsMulti = [
37
+ {
38
+ testId: 1,
39
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
40
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
41
+ bidId: '2899ec066a91ff8',
42
+ bidRequestsCount: 1,
43
+ bidder: 'newspassid',
44
+ bidderRequestId: '1c1586b27a1b5c8',
45
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
46
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
47
+ sizes: [[300, 250], [300, 600]],
48
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
49
+ },
50
+ {
51
+ testId: 2,
52
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
53
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
54
+ bidId: '2899ec066a91ff0',
55
+ bidRequestsCount: 1,
56
+ bidder: 'newspassid',
57
+ bidderRequestId: '1c1586b27a1b5c0',
58
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
59
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
60
+ sizes: [[300, 250], [300, 600]],
61
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
62
+ }
63
+ ];
64
+ var validBidRequestsWithUserIdData = [
65
+ {
66
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
67
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
68
+ bidId: '2899ec066a91ff8',
69
+ bidRequestsCount: 1,
70
+ bidder: 'newspassid',
71
+ bidderRequestId: '1c1586b27a1b5c8',
72
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
73
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
74
+ sizes: [[300, 250], [300, 600]],
75
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87',
76
+ userId: {
77
+ 'pubcid': '12345678',
78
+ 'tdid': '1111tdid',
79
+ 'id5id': { uid: '1111', ext: { linkType: 2, abTestingControlGroup: false } },
80
+ 'criteoId': '1111criteoId',
81
+ 'idl_env': 'liverampId',
82
+ 'lipb': {'lipbid': 'lipbidId123'},
83
+ 'parrableId': {'eid': '01.5678.parrableid'},
84
+ 'sharedid': {'id': '01EAJWWNEPN3CYMM5N8M5VXY22', 'third': '01EAJWWNEPN3CYMM5N8M5VXY22'}
85
+ },
86
+ userIdAsEids: [
87
+ {
88
+ 'source': 'pubcid.org',
89
+ 'uids': [
90
+ {
91
+ 'id': '12345678',
92
+ 'atype': 1
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ 'source': 'adserver.org',
98
+ 'uids': [{
99
+ 'id': '1111tdid',
100
+ 'atype': 1,
101
+ 'ext': {
102
+ 'rtiPartner': 'TDID'
103
+ }
104
+ }]
105
+ },
106
+ {
107
+ 'source': 'id5-sync.com',
108
+ 'uids': [{
109
+ 'id': 'ID5-someId',
110
+ 'atype': 1,
111
+ }]
112
+ },
113
+ {
114
+ 'source': 'criteoId',
115
+ 'uids': [{
116
+ 'id': '1111criteoId',
117
+ 'atype': 1,
118
+ }]
119
+ },
120
+ {
121
+ 'source': 'idl_env',
122
+ 'uids': [{
123
+ 'id': 'liverampId',
124
+ 'atype': 1,
125
+ }]
126
+ },
127
+ {
128
+ 'source': 'lipb',
129
+ 'uids': [{
130
+ 'id': {'lipbid': 'lipbidId123'},
131
+ 'atype': 1,
132
+ }]
133
+ },
134
+ {
135
+ 'source': 'parrableId',
136
+ 'uids': [{
137
+ 'id': {'eid': '01.5678.parrableid'},
138
+ 'atype': 1,
139
+ }]
140
+ }
141
+ ]
142
+ }
143
+ ];
144
+ var validBidRequestsMinimal = [
145
+ {
146
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
147
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
148
+ bidId: '2899ec066a91ff8',
149
+ bidRequestsCount: 1,
150
+ bidder: 'newspassid',
151
+ bidderRequestId: '1c1586b27a1b5c8',
152
+ params: { publisherId: '9876abcd12-3', placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
153
+ sizes: [[300, 250], [300, 600]],
154
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
155
+ }
156
+ ];
157
+ var validBidRequestsNoSizes = [
158
+ {
159
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
160
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
161
+ bidId: '2899ec066a91ff8',
162
+ bidRequestsCount: 1,
163
+ bidder: 'newspassid',
164
+ bidderRequestId: '1c1586b27a1b5c8',
165
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
166
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
167
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
168
+ }
169
+ ];
170
+ var validBidRequestsWithBannerMediaType = [
171
+ {
172
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
173
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
174
+ bidId: '2899ec066a91ff8',
175
+ bidRequestsCount: 1,
176
+ bidder: 'newspassid',
177
+ bidderRequestId: '1c1586b27a1b5c8',
178
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
179
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { id: '2899ec066a91ff8', tagid: 'undefined', secure: 1, banner: { format: [{ w: 300, h: 250 }, { w: 300, h: 600 }], h: 250, topframe: 1, w: 300 } } ] },
180
+ mediaTypes: {banner: {sizes: [[300, 250], [300, 600]]}},
181
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
182
+ }
183
+ ];
184
+ var validBidRequestsIsThisCamelCaseEnough = [
185
+ {
186
+ 'bidder': 'newspassid',
187
+ 'testname': 'validBidRequestsIsThisCamelCaseEnough',
188
+ 'params': {
189
+ 'publisherId': 'newspassRUP0001',
190
+ 'placementId': '8000000009',
191
+ 'siteId': '4204204201',
192
+ 'customData': [
193
+ {
194
+ 'settings': {},
195
+ 'targeting': {
196
+ 'sens': 'f',
197
+ 'pt1': '/uk',
198
+ 'pt2': 'uk',
199
+ 'pt3': 'network-front',
200
+ 'pt4': 'ng',
201
+ 'pt5': [
202
+ 'uk'
203
+ ],
204
+ 'pt7': 'desktop',
205
+ 'pt8': [
206
+ 'tfmqxwj7q',
207
+ 'penl4dfdk',
208
+ 'sek9ghqwi'
209
+ ],
210
+ 'pt9': '|k0xw2vqzp33kklb3j5w4|||'
211
+ }
212
+ }
213
+ ],
214
+ 'userId': {
215
+ 'pubcid': '2ada6ae6-aeca-4e07-8922-a99b3aaf8a56'
216
+ },
217
+ 'userIdAsEids': [
218
+ {
219
+ 'source': 'pubcid.org',
220
+ 'uids': [
221
+ {
222
+ 'id': '2ada6ae6-aeca-4e07-8922-a99b3aaf8a56',
223
+ 'atype': 1
224
+ }
225
+ ]
226
+ }
227
+ ]
228
+ },
229
+ mediaTypes: {banner: {sizes: [[300, 250], [300, 600]]}},
230
+ 'adUnitCode': 'some-ad',
231
+ 'transactionId': '02c1ea7d-0bf2-451b-a122-1420040d1cf8',
232
+ 'bidId': '2899ec066a91ff8',
233
+ 'bidderRequestId': '1c1586b27a1b5c8',
234
+ 'auctionId': '0456c9b7-5ab2-4fec-9e10-f418d3d1f04c',
235
+ 'src': 'client',
236
+ 'bidRequestsCount': 1,
237
+ 'bidderRequestsCount': 1,
238
+ 'bidderWinsCount': 0
239
+ }
240
+ ];
241
+ var validBidderRequest = {
242
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
243
+ auctionStart: 1536838908986,
244
+ bidderCode: 'newspassid',
245
+ bidderRequestId: '1c1586b27a1b5c8',
246
+ bids: [{
247
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
248
+ auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
249
+ bidId: '2899ec066a91ff8',
250
+ bidRequestsCount: 1,
251
+ bidder: 'newspassid',
252
+ bidderRequestId: '1c1586b27a1b5c8',
253
+ crumbs: {pubcid: '203a0692-f728-4856-87f6-9a25a6b63715'},
254
+ params: { publisherId: '9876abcd12-3', customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}], placementId: '1310000099', siteId: '1234567890', id: 'fea37168-78f1-4a23-a40e-88437a99377e', auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99', imp: [ { banner: { topframe: 1, w: 300, h: 250, format: [{ w: 300, h: 250 }, { w: 300, h: 600 }] }, id: '2899ec066a91ff8', secure: 1, tagid: 'undefined' } ] },
255
+ sizes: [[300, 250], [300, 600]],
256
+ transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
257
+ }],
258
+ doneCbCallCount: 1,
259
+ start: 1536838908987,
260
+ timeout: 3000
261
+ };
262
+ var emptyObject = {};
263
+ var validResponse = {
264
+ 'body': {
265
+ 'id': 'd6198807-7a53-4141-b2db-d2cb754d68ba',
266
+ 'seatbid': [
267
+ {
268
+ 'bid': [
269
+ {
270
+ 'id': '677903815252395017',
271
+ 'impid': '2899ec066a91ff8',
272
+ 'price': 0.5,
273
+ 'adm': '<script src="https://fra1-ib.adnxs.com/ab?e=wqT_3QLXB6DXAwAAAwDWAAUBCNDh6dwFENjt4vTs9Y6bWhjxtI3siuOTmREqNgkAAAECCOA_EQEHNAAA4D8ZAAAAgOtR4D8hERIAKREJADERG6gwsqKiBjjtSEDtSEgCUI3J-y5YnPFbYABotc95eMuOBYABAYoBA1VTRJIBAQbwUpgBrAKgAdgEqAEBsAEAuAECwAEDyAEC0AEA2AEA4AEA8AEAigI7dWYoJ2EnLCAyNTI5ODg1LCAxNTM2ODQ4MDgwKTt1ZigncicsIDk4NDkzNTgxNh4A8JySAv0BIWJ6YWpPQWl1c0s0S0VJM0oteTRZQUNDYzhWc3dBRGdBUUFSSTdVaFFzcUtpQmxnQVlQX19fXzhQYUFCd0FYZ0JnQUVCaUFFQmtBRUJtQUVCb0FFQnFBRURzQUVBdVFFcGk0aURBQURnUDhFQktZdUlnd0FBNERfSkFUMDR0TTFxYXZFXzJRRUFBQUFBQUFEd1AtQUJBUFVCBQ8oSmdDQUtBQ0FMVUMFEARMMAkI8FBNQUNBY2dDQWRBQ0FkZ0NBZUFDQU9nQ0FQZ0NBSUFEQVpBREFKZ0RBYWdEcnJDdUNyb0RDVVpTUVRFNk16WTROT0FER2cuLpoCPSFLQXVvRkE2AAFwblBGYklBUW9BRG9KUmxKQk1Ub3pOamcwUUJwSkENAfBAOEQ4LsICL2h0dHA6Ly9wcmViaWQub3JnL2Rldi1kb2NzL2dldHRpbmctc3RhcnRlZC5odG1s2AIA4AKtmEjqAiINOthkZW1vLnRnpS1vem9uZS1wcm9qZWN0LmNvbS_yAhMKD0NVU1RPTV9NT0RFTF9JRBIA8gIaChZDLhYAIExFQUZfTkFNRQEdCB4KGjIzAPCHTEFTVF9NT0RJRklFRBIAgAMAiAMBkAMAmAMUoAMBqgMAwAOsAsgDANgDAOADAOgDAPgDA4AEAJIECS9vcGVucnRiMpgEAKIECTEyNy4wLjAuMagEALIEDAgAEAAYACAAMAA4ALgEAMAEAMgEANIEDjkzMjUjRlJBMTnpNjg02gQCCAHgBADwBEHvIIgFAZgFAKAF_xEBsAGqBSRkNjE5ODgwNy03YTUzLTQxNDEtYjJkYi1kMmNiNzU0ZDY4YmHABQDJBWlQFPA_0gUJCQkMpAAA2AUB4AUB8AWZ9CH6BQQIABAAkAYAmAYAuAYAwQYAAAAAAAAAAMgGAA..&s=ab84b182eef7d9b4e58c74fe8987705c25ed803c&referrer=http%3A%2F%2Fdemo.the-some-project.com%2F&pp=${AUCTION_PRICE}"></script>',
274
+ 'adid': '98493581',
275
+ 'adomain': [
276
+ 'http://prebid.org'
277
+ ],
278
+ 'iurl': 'https://fra1-ib.adnxs.com/cr?id=98493581',
279
+ 'cid': '9325',
280
+ 'crid': '98493581',
281
+ 'cat': [
282
+ 'IAB3-1'
283
+ ],
284
+ 'w': 300,
285
+ 'h': 600,
286
+ 'ext': {
287
+ 'prebid': {
288
+ 'type': 'banner'
289
+ },
290
+ 'bidder': {
291
+ 'appnexus': {
292
+ 'brand_id': 555545,
293
+ 'auction_id': 6500448734132353000,
294
+ 'bidder_id': 2,
295
+ 'bid_ad_type': 0
296
+ }
297
+ }
298
+ }
299
+ }
300
+ ],
301
+ 'seat': 'appnexus'
302
+ }
303
+ ],
304
+ 'cur': 'GBP', /* NOTE - this is where cur is, not in the seatbids. */
305
+ 'ext': {
306
+ 'responsetimemillis': {
307
+ 'appnexus': 47,
308
+ 'openx': 30
309
+ }
310
+ },
311
+ 'timing': {
312
+ 'start': 1536848078.089177,
313
+ 'end': 1536848078.142203,
314
+ 'TimeTaken': 0.05302619934082031
315
+ }
316
+ },
317
+ 'headers': {}
318
+ };
319
+ var validResponse2BidsSameAdunit = {
320
+ 'body': {
321
+ 'id': 'd6198807-7a53-4141-b2db-d2cb754d68ba',
322
+ 'seatbid': [
323
+ {
324
+ 'bid': [
325
+ {
326
+ 'id': '677903815252395017',
327
+ 'impid': '2899ec066a91ff8',
328
+ 'price': 0.5,
329
+ 'adm': '<script src="src-1"></script>',
330
+ 'adid': '98493581',
331
+ 'adomain': [
332
+ 'http://prebid.org'
333
+ ],
334
+ 'iurl': 'https://fra1-ib.adnxs.com/cr?id=98493581',
335
+ 'cid': '9325',
336
+ 'crid': '98493581',
337
+ 'cat': [
338
+ 'IAB3-1'
339
+ ],
340
+ 'w': 300,
341
+ 'h': 600,
342
+ 'ext': {
343
+ 'prebid': {
344
+ 'type': 'banner'
345
+ },
346
+ 'bidder': {
347
+ 'appnexus': {
348
+ 'brand_id': 555545,
349
+ 'auction_id': 6500448734132353000,
350
+ 'bidder_id': 2,
351
+ 'bid_ad_type': 0
352
+ }
353
+ }
354
+ }
355
+ },
356
+ {
357
+ 'id': '677903815252395010',
358
+ 'impid': '2899ec066a91ff8',
359
+ 'price': 0.9,
360
+ 'adm': '<script src="src-2"></script>',
361
+ 'adid': '98493580',
362
+ 'adomain': [
363
+ 'http://prebid.org'
364
+ ],
365
+ 'iurl': 'https://fra1-ib.adnxs.com/cr?id=98493581',
366
+ 'cid': '9320',
367
+ 'crid': '98493580',
368
+ 'cat': [
369
+ 'IAB3-1'
370
+ ],
371
+ 'w': 300,
372
+ 'h': 250,
373
+ 'ext': {
374
+ 'prebid': {
375
+ 'type': 'banner'
376
+ },
377
+ 'bidder': {
378
+ 'appnexus': {
379
+ 'brand_id': 555540,
380
+ 'auction_id': 6500448734132353000,
381
+ 'bidder_id': 2,
382
+ 'bid_ad_type': 0
383
+ }
384
+ }
385
+ }
386
+ } ],
387
+ 'seat': 'npappnexus'
388
+ }
389
+ ],
390
+ 'cur': 'GBP', /* NOTE - this is where cur is, not in the seatbids. */
391
+ 'ext': {
392
+ 'responsetimemillis': {
393
+ 'appnexus': 47,
394
+ 'openx': 30
395
+ }
396
+ },
397
+ 'timing': {
398
+ 'start': 1536848078.089177,
399
+ 'end': 1536848078.142203,
400
+ 'TimeTaken': 0.05302619934082031
401
+ }
402
+ },
403
+ 'headers': {}
404
+ };
405
+ var validBidResponse1adWith2Bidders = {
406
+ 'body': {
407
+ 'id': '91221f96-b931-4acc-8f05-c2a1186fa5ac',
408
+ 'seatbid': [
409
+ {
410
+ 'bid': [
411
+ {
412
+ 'id': 'd6198807-7a53-4141-b2db-d2cb754d68ba',
413
+ 'impid': '2899ec066a91ff8',
414
+ 'price': 0.36754,
415
+ 'adm': '<script>removed</script>',
416
+ 'adid': '134928661',
417
+ 'adomain': [
418
+ 'somecompany.com'
419
+ ],
420
+ 'iurl': 'https:\/\/ams1-ib.adnxs.com\/cr?id=134928661',
421
+ 'cid': '8825',
422
+ 'crid': '134928661',
423
+ 'cat': [
424
+ 'IAB8-15',
425
+ 'IAB8-16',
426
+ 'IAB8-4',
427
+ 'IAB8-1',
428
+ 'IAB8-14',
429
+ 'IAB8-6',
430
+ 'IAB8-13',
431
+ 'IAB8-3',
432
+ 'IAB8-17',
433
+ 'IAB8-12',
434
+ 'IAB8-8',
435
+ 'IAB8-7',
436
+ 'IAB8-2',
437
+ 'IAB8-9',
438
+ 'IAB8',
439
+ 'IAB8-11'
440
+ ],
441
+ 'w': 300,
442
+ 'h': 250,
443
+ 'ext': {
444
+ 'prebid': {
445
+ 'type': 'banner'
446
+ },
447
+ 'bidder': {
448
+ 'appnexus': {
449
+ 'brand_id': 14640,
450
+ 'auction_id': 1.8369641905139e+18,
451
+ 'bidder_id': 2,
452
+ 'bid_ad_type': 0
453
+ }
454
+ }
455
+ }
456
+ }
457
+ ],
458
+ 'seat': 'appnexus'
459
+ },
460
+ {
461
+ 'bid': [
462
+ {
463
+ 'id': '75665207-a1ca-49db-ba0e-a5e9c7d26f32',
464
+ 'impid': '37fff511779365a',
465
+ 'price': 1.046,
466
+ 'adm': '<div>removed</div>',
467
+ 'adomain': [
468
+ 'kx.com'
469
+ ],
470
+ 'crid': '13005',
471
+ 'w': 300,
472
+ 'h': 250,
473
+ 'ext': {
474
+ 'prebid': {
475
+ 'type': 'banner'
476
+ }
477
+ }
478
+ }
479
+ ],
480
+ 'seat': 'openx'
481
+ }
482
+ ],
483
+ 'ext': {
484
+ 'responsetimemillis': {
485
+ 'appnexus': 91,
486
+ 'openx': 109,
487
+ 'npappnexus': 46,
488
+ 'npbeeswax': 2,
489
+ 'pangaea': 91
490
+ }
491
+ }
492
+ },
493
+ 'headers': {}
494
+ };
495
+ var multiRequest1 = [
496
+ {
497
+ 'bidder': 'newspassid',
498
+ 'params': {
499
+ 'publisherId': 'newspassRUP0001',
500
+ 'siteId': '4204204201',
501
+ 'placementId': '0420420421',
502
+ 'customData': [
503
+ {
504
+ 'settings': {},
505
+ 'targeting': {
506
+ 'sens': 'f',
507
+ 'pt1': '/uk',
508
+ 'pt2': 'uk',
509
+ 'pt3': 'network-front',
510
+ 'pt4': 'ng',
511
+ 'pt5': [
512
+ 'uk'
513
+ ],
514
+ 'pt7': 'desktop',
515
+ 'pt8': [
516
+ 'tfmqxwj7q',
517
+ 'penl4dfdk',
518
+ 'uayf5jmv3',
519
+ 't8nyiude5',
520
+ 'sek9ghqwi'
521
+ ],
522
+ 'pt9': '|k0xw2vqzp33kklb3j5w4|||'
523
+ }
524
+ }
525
+ ]
526
+ },
527
+ 'mediaTypes': {
528
+ 'banner': {
529
+ 'sizes': [
530
+ [
531
+ 300,
532
+ 250
533
+ ],
534
+ [
535
+ 300,
536
+ 600
537
+ ]
538
+ ]
539
+ }
540
+ },
541
+ 'adUnitCode': 'mpu',
542
+ 'transactionId': '6480bac7-31b5-4723-9145-ad8966660651',
543
+ 'sizes': [
544
+ [
545
+ 300,
546
+ 250
547
+ ],
548
+ [
549
+ 300,
550
+ 600
551
+ ]
552
+ ],
553
+ 'bidId': '2d30e86db743a8',
554
+ 'bidderRequestId': '1d03a1dfc563fc',
555
+ 'auctionId': '592ee33b-fb2e-4c00-b2d5-383e99cac57f',
556
+ 'src': 'client',
557
+ 'bidRequestsCount': 1,
558
+ 'bidderRequestsCount': 1,
559
+ 'bidderWinsCount': 0
560
+ },
561
+ {
562
+ 'bidder': 'newspassid',
563
+ 'params': {
564
+ 'publisherId': 'newspassRUP0001',
565
+ 'siteId': '4204204201',
566
+ 'placementId': '0420420421',
567
+ 'customData': [
568
+ {
569
+ 'settings': {},
570
+ 'targeting': {
571
+ 'sens': 'f',
572
+ 'pt1': '/uk',
573
+ 'pt2': 'uk',
574
+ 'pt3': 'network-front',
575
+ 'pt4': 'ng',
576
+ 'pt5': [
577
+ 'uk'
578
+ ],
579
+ 'pt7': 'desktop',
580
+ 'pt8': [
581
+ 'tfmqxwj7q',
582
+ 'penl4dfdk',
583
+ 't8nxz6qzd',
584
+ 't8nyiude5',
585
+ 'sek9ghqwi'
586
+ ],
587
+ 'pt9': '|k0xw2vqzp33kklb3j5w4|||'
588
+ }
589
+ }
590
+ ]
591
+ },
592
+ 'mediaTypes': {
593
+ 'banner': {
594
+ 'sizes': [
595
+ [
596
+ 728,
597
+ 90
598
+ ],
599
+ [
600
+ 970,
601
+ 250
602
+ ]
603
+ ]
604
+ }
605
+ },
606
+ 'adUnitCode': 'leaderboard',
607
+ 'transactionId': 'a49988e6-ae7c-46c4-9598-f18db49892a0',
608
+ 'sizes': [
609
+ [
610
+ 728,
611
+ 90
612
+ ],
613
+ [
614
+ 970,
615
+ 250
616
+ ]
617
+ ],
618
+ 'bidId': '3025f169863b7f8',
619
+ 'bidderRequestId': '1d03a1dfc563fc',
620
+ 'auctionId': '592ee33b-fb2e-4c00-b2d5-383e99cac57f',
621
+ 'src': 'client',
622
+ 'bidRequestsCount': 1,
623
+ 'bidderRequestsCount': 1,
624
+ 'bidderWinsCount': 0
625
+ }
626
+ ];
627
+ var multiBidderRequest1 = {
628
+ bidderRequest: {
629
+ 'bidderCode': 'newspassid',
630
+ 'auctionId': '592ee33b-fb2e-4c00-b2d5-383e99cac57f',
631
+ 'bidderRequestId': '1d03a1dfc563fc',
632
+ 'bids': [
633
+ {
634
+ 'bidder': 'newspassid',
635
+ 'params': {
636
+ 'publisherId': 'newspassRUP0001',
637
+ 'siteId': '4204204201',
638
+ 'placementId': '0420420421',
639
+ 'customData': [
640
+ {
641
+ 'settings': {},
642
+ 'targeting': {
643
+ 'sens': 'f',
644
+ 'pt1': '/uk',
645
+ 'pt2': 'uk',
646
+ 'pt3': 'network-front',
647
+ 'pt4': 'ng',
648
+ 'pt5': [
649
+ 'uk'
650
+ ],
651
+ 'pt7': 'desktop',
652
+ 'pt8': [
653
+ 'tfmqxwj7q',
654
+ 'txeh7uyo0',
655
+ 't8nxz6qzd',
656
+ 't8nyiude5',
657
+ 'sek9ghqwi'
658
+ ],
659
+ 'pt9': '|k0xw2vqzp33kklb3j5w4|||'
660
+ }
661
+ }
662
+ ]
663
+ },
664
+ 'mediaTypes': {
665
+ 'banner': {
666
+ 'sizes': [
667
+ [
668
+ 300,
669
+ 250
670
+ ],
671
+ [
672
+ 300,
673
+ 600
674
+ ]
675
+ ]
676
+ }
677
+ },
678
+ 'adUnitCode': 'mpu',
679
+ 'transactionId': '6480bac7-31b5-4723-9145-ad8966660651',
680
+ 'sizes': [
681
+ [
682
+ 300,
683
+ 250
684
+ ],
685
+ [
686
+ 300,
687
+ 600
688
+ ]
689
+ ],
690
+ 'bidId': '2d30e86db743a8',
691
+ 'bidderRequestId': '1d03a1dfc563fc',
692
+ 'auctionId': '592ee33b-fb2e-4c00-b2d5-383e99cac57f',
693
+ 'src': 'client',
694
+ 'bidRequestsCount': 1,
695
+ 'bidderRequestsCount': 1,
696
+ 'bidderWinsCount': 0
697
+ },
698
+ {
699
+ 'bidder': 'newspassid',
700
+ 'params': {
701
+ 'publisherId': 'newspassRUP0001',
702
+ 'siteId': '4204204201',
703
+ 'placementId': '0420420421',
704
+ 'customData': [
705
+ {
706
+ 'settings': {},
707
+ 'targeting': {
708
+ 'sens': 'f',
709
+ 'pt1': '/uk',
710
+ 'pt2': 'uk',
711
+ 'pt3': 'network-front',
712
+ 'pt4': 'ng',
713
+ 'pt5': [
714
+ 'uk'
715
+ ],
716
+ 'pt7': 'desktop',
717
+ 'pt8': [
718
+ 'tfmqxwj7q',
719
+ 'penl4dfdk',
720
+ 't8nxz6qzd',
721
+ 't8nyiude5',
722
+ 'sek9ghqwi'
723
+ ],
724
+ 'pt9': '|k0xw2vqzp33kklb3j5w4|||'
725
+ }
726
+ }
727
+ ]
728
+ },
729
+ 'mediaTypes': {
730
+ 'banner': {
731
+ 'sizes': [
732
+ [
733
+ 728,
734
+ 90
735
+ ],
736
+ [
737
+ 970,
738
+ 250
739
+ ]
740
+ ]
741
+ }
742
+ },
743
+ 'adUnitCode': 'leaderboard',
744
+ 'transactionId': 'a49988e6-ae7c-46c4-9598-f18db49892a0',
745
+ 'sizes': [
746
+ [
747
+ 728,
748
+ 90
749
+ ],
750
+ [
751
+ 970,
752
+ 250
753
+ ]
754
+ ],
755
+ 'bidId': '3025f169863b7f8',
756
+ 'bidderRequestId': '1d03a1dfc563fc',
757
+ 'auctionId': '592ee33b-fb2e-4c00-b2d5-383e99cac57f',
758
+ 'src': 'client',
759
+ 'bidRequestsCount': 1,
760
+ 'bidderRequestsCount': 1,
761
+ 'bidderWinsCount': 0
762
+ }
763
+ ],
764
+ 'auctionStart': 1592918645574,
765
+ 'timeout': 3000,
766
+ 'refererInfo': {
767
+ 'referer': 'http://some.referrer.com',
768
+ 'reachedTop': true,
769
+ 'numIframes': 0,
770
+ 'stack': [
771
+ 'http://some.referrer.com'
772
+ ]
773
+ },
774
+ 'start': 1592918645578
775
+ }
776
+ };
777
+ var multiResponse1 = {
778
+ 'body': {
779
+ 'id': '592ee33b-fb2e-4c00-b2d5-383e99cac57f',
780
+ 'seatbid': [
781
+ {
782
+ 'bid': [
783
+ {
784
+ 'id': '4419718600113204943',
785
+ 'impid': '2d30e86db743a8',
786
+ 'price': 0.2484,
787
+ 'adm': '<scr .. .iv>',
788
+ 'adid': '119683582',
789
+ 'adomain': [
790
+ 'https://someurl.com'
791
+ ],
792
+ 'iurl': 'https://ams1-ib.adnxs.com/cr?id=119683582',
793
+ 'cid': '9979',
794
+ 'crid': '119683582',
795
+ 'cat': [
796
+ 'IAB3'
797
+ ],
798
+ 'w': 300,
799
+ 'h': 250,
800
+ 'ext': {
801
+ 'prebid': {
802
+ 'type': 'banner'
803
+ },
804
+ 'bidder': {
805
+ 'newspassid': {},
806
+ 'appnexus': {
807
+ 'brand_id': 734921,
808
+ 'auction_id': 2995348111857539600,
809
+ 'bidder_id': 2,
810
+ 'bid_ad_type': 0
811
+ }
812
+ }
813
+ },
814
+ 'cpm': 0.2484,
815
+ 'bidId': '2d30e86db743a8',
816
+ 'requestId': '2d30e86db743a8',
817
+ 'width': 300,
818
+ 'height': 250,
819
+ 'ad': '<scr...iv>',
820
+ 'netRevenue': true,
821
+ 'creativeId': '119683582',
822
+ 'currency': 'USD',
823
+ 'ttl': 300,
824
+ 'originalCpm': 0.2484,
825
+ 'originalCurrency': 'USD'
826
+ },
827
+ {
828
+ 'id': '18552976939844681',
829
+ 'impid': '3025f169863b7f8',
830
+ 'price': 0.0621,
831
+ 'adm': '<sc..this ad will lose to the next one.div>',
832
+ 'adid': '120179216',
833
+ 'adomain': [
834
+ 'appnexus.com'
835
+ ],
836
+ 'iurl': 'https://ams1-ib.adnxs.com/cr?id=120179216',
837
+ 'cid': '9979',
838
+ 'crid': '120179216',
839
+ 'w': 970,
840
+ 'h': 250,
841
+ 'ext': {
842
+ 'prebid': {
843
+ 'type': 'banner'
844
+ },
845
+ 'bidder': {
846
+ 'newspassid': {},
847
+ 'appnexus': {
848
+ 'brand_id': 1,
849
+ 'auction_id': 3449036134472542700,
850
+ 'bidder_id': 2,
851
+ 'bid_ad_type': 0
852
+ }
853
+ }
854
+ },
855
+ 'cpm': 0.0621,
856
+ 'bidId': '3025f169863b7f8',
857
+ 'requestId': '3025f169863b7f8',
858
+ 'width': 970,
859
+ 'height': 250,
860
+ 'ad': '<scr...iv>',
861
+ 'netRevenue': true,
862
+ 'creativeId': '120179216',
863
+ 'currency': 'USD',
864
+ 'ttl': 300,
865
+ 'originalCpm': 0.0621,
866
+ 'originalCurrency': 'USD'
867
+ },
868
+ {
869
+ 'id': '18552976939844999',
870
+ 'impid': '3025f169863b7f8',
871
+ 'price': 0.521,
872
+ 'adm': '<sc. second bid for bidId 3025f169863b7f8 ..div>',
873
+ 'adid': '120179216',
874
+ 'adomain': [
875
+ 'appnexus.com'
876
+ ],
877
+ 'iurl': 'https://ams1-ib.adnxs.com/cr?id=120179216',
878
+ 'cid': '9999',
879
+ 'crid': '120179299',
880
+ 'w': 728,
881
+ 'h': 90,
882
+ 'ext': {
883
+ 'prebid': {
884
+ 'type': 'banner'
885
+ },
886
+ 'bidder': {
887
+ 'newspassid': {},
888
+ 'appnexus': {
889
+ 'brand_id': 1,
890
+ 'auction_id': 3449036134472542700,
891
+ 'bidder_id': 2,
892
+ 'bid_ad_type': 0
893
+ }
894
+ }
895
+ },
896
+ 'cpm': 0.521,
897
+ 'bidId': '3025f169863b7f8',
898
+ 'requestId': '3025f169863b7f8',
899
+ 'width': 728,
900
+ 'height': 90,
901
+ 'ad': '<scr...iv>',
902
+ 'netRevenue': true,
903
+ 'creativeId': '120179299',
904
+ 'currency': 'USD',
905
+ 'ttl': 300,
906
+ 'originalCpm': 0.0621,
907
+ 'originalCurrency': 'USD'
908
+ }
909
+ ],
910
+ 'seat': 'npappnexus'
911
+ },
912
+ {
913
+ 'bid': [
914
+ {
915
+ 'id': '1c605e8a-4992-4ec6-8a5c-f82e2938c2db',
916
+ 'impid': '2d30e86db743a8',
917
+ 'price': 0.01,
918
+ 'adm': '<div ... div>',
919
+ 'crid': '540463358',
920
+ 'w': 300,
921
+ 'h': 250,
922
+ 'ext': {
923
+ 'prebid': {
924
+ 'type': 'banner'
925
+ },
926
+ 'bidder': {
927
+ 'newspassid': {}
928
+ }
929
+ },
930
+ 'cpm': 0.01,
931
+ 'bidId': '2d30e86db743a8',
932
+ 'requestId': '2d30e86db743a8',
933
+ 'width': 300,
934
+ 'height': 250,
935
+ 'ad': '<div ...div>',
936
+ 'netRevenue': true,
937
+ 'creativeId': '540463358',
938
+ 'currency': 'USD',
939
+ 'ttl': 300,
940
+ 'originalCpm': 0.01,
941
+ 'originalCurrency': 'USD'
942
+ },
943
+ {
944
+ 'id': '3edeb4f7-d91d-44e2-8aeb-4a2f6d295ce5',
945
+ 'impid': '3025f169863b7f8',
946
+ 'price': 0.01,
947
+ 'adm': '<div ... div>',
948
+ 'crid': '540221061',
949
+ 'w': 970,
950
+ 'h': 250,
951
+ 'ext': {
952
+ 'prebid': {
953
+ 'type': 'banner'
954
+ },
955
+ 'bidder': {
956
+ 'newspassid': {}
957
+ }
958
+ },
959
+ 'cpm': 0.01,
960
+ 'bidId': '3025f169863b7f8',
961
+ 'requestId': '3025f169863b7f8',
962
+ 'width': 970,
963
+ 'height': 250,
964
+ 'ad': '<div ... div>',
965
+ 'netRevenue': true,
966
+ 'creativeId': '540221061',
967
+ 'currency': 'USD',
968
+ 'ttl': 300,
969
+ 'originalCpm': 0.01,
970
+ 'originalCurrency': 'USD'
971
+ }
972
+ ],
973
+ 'seat': 'openx'
974
+ }
975
+ ],
976
+ 'ext': {
977
+ 'debug': {},
978
+ 'responsetimemillis': {
979
+ 'beeswax': 6,
980
+ 'openx': 91,
981
+ 'npappnexus': 40,
982
+ 'npbeeswax': 6
983
+ }
984
+ }
985
+ },
986
+ 'headers': {}
987
+ };
988
+ describe('newspassid Adapter', function () {
989
+ describe('isBidRequestValid', function () {
990
+ let validBidReq = {
991
+ bidder: BIDDER_CODE,
992
+ params: {
993
+ placementId: '1310000099',
994
+ publisherId: '9876abcd12-3',
995
+ siteId: '1234567890'
996
+ }
997
+ };
998
+ it('should return true when required params found', function () {
999
+ expect(spec.isBidRequestValid(validBidReq)).to.equal(true);
1000
+ });
1001
+ var validBidReq2 = {
1002
+ bidder: BIDDER_CODE,
1003
+ params: {
1004
+ placementId: '1310000099',
1005
+ publisherId: '9876abcd12-3',
1006
+ siteId: '1234567890',
1007
+ customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}]
1008
+ },
1009
+ siteId: 1234567890
1010
+ }
1011
+ it('should return true when required params found and all optional params are valid', function () {
1012
+ expect(spec.isBidRequestValid(validBidReq2)).to.equal(true);
1013
+ });
1014
+ var xEmptyPlacement = {
1015
+ bidder: BIDDER_CODE,
1016
+ params: {
1017
+ placementId: '',
1018
+ publisherId: '9876abcd12-3',
1019
+ siteId: '1234567890'
1020
+ }
1021
+ };
1022
+ it('should not validate empty placementId', function () {
1023
+ expect(spec.isBidRequestValid(xEmptyPlacement)).to.equal(false);
1024
+ });
1025
+ var xMissingPlacement = {
1026
+ bidder: BIDDER_CODE,
1027
+ params: {
1028
+ publisherId: '9876abcd12-3',
1029
+ siteId: '1234567890'
1030
+ }
1031
+ };
1032
+ it('should not validate missing placementId', function () {
1033
+ expect(spec.isBidRequestValid(xMissingPlacement)).to.equal(false);
1034
+ });
1035
+ var xBadPlacement = {
1036
+ bidder: BIDDER_CODE,
1037
+ params: {
1038
+ placementId: '123X45',
1039
+ publisherId: '9876abcd12-3',
1040
+ siteId: '1234567890'
1041
+ }
1042
+ };
1043
+ it('should not validate placementId with a non-numeric value', function () {
1044
+ expect(spec.isBidRequestValid(xBadPlacement)).to.equal(false);
1045
+ });
1046
+ var xBadPlacementTooShort = {
1047
+ bidder: BIDDER_CODE,
1048
+ params: {
1049
+ placementId: 123456789, /* should be exactly 10 chars */
1050
+ publisherId: '9876abcd12-3',
1051
+ siteId: '1234567890'
1052
+ }
1053
+ };
1054
+ it('should not validate placementId with a numeric value of wrong length', function () {
1055
+ expect(spec.isBidRequestValid(xBadPlacementTooShort)).to.equal(false);
1056
+ });
1057
+ var xBadPlacementTooLong = {
1058
+ bidder: BIDDER_CODE,
1059
+ params: {
1060
+ placementId: 12345678901, /* should be exactly 10 chars */
1061
+ publisherId: '9876abcd12-3',
1062
+ siteId: '1234567890'
1063
+ }
1064
+ };
1065
+ it('should not validate placementId with a numeric value of wrong length', function () {
1066
+ expect(spec.isBidRequestValid(xBadPlacementTooLong)).to.equal(false);
1067
+ });
1068
+ var xMissingPublisher = {
1069
+ bidder: BIDDER_CODE,
1070
+ params: {
1071
+ placementId: '1234567890',
1072
+ siteId: '1234567890'
1073
+ }
1074
+ };
1075
+ it('should not validate missing publisherId', function () {
1076
+ expect(spec.isBidRequestValid(xMissingPublisher)).to.equal(false);
1077
+ });
1078
+ var xMissingSiteId = {
1079
+ bidder: BIDDER_CODE,
1080
+ params: {
1081
+ publisherId: '9876abcd12-3',
1082
+ placementId: '1234567890',
1083
+ }
1084
+ };
1085
+ it('should not validate missing sitetId', function () {
1086
+ expect(spec.isBidRequestValid(xMissingSiteId)).to.equal(false);
1087
+ });
1088
+ var xBadPublisherTooShort = {
1089
+ bidder: BIDDER_CODE,
1090
+ params: {
1091
+ placementId: '1234567890',
1092
+ publisherId: '9876abcd12a',
1093
+ siteId: '1234567890'
1094
+ }
1095
+ };
1096
+ it('should not validate publisherId being too short', function () {
1097
+ expect(spec.isBidRequestValid(xBadPublisherTooShort)).to.equal(false);
1098
+ });
1099
+ var xBadPublisherTooLong = {
1100
+ bidder: BIDDER_CODE,
1101
+ params: {
1102
+ placementId: '1234567890',
1103
+ publisherId: '9876abcd12abc',
1104
+ siteId: '1234567890'
1105
+ }
1106
+ };
1107
+ it('should not validate publisherId being too long', function () {
1108
+ expect(spec.isBidRequestValid(xBadPublisherTooLong)).to.equal(false);
1109
+ });
1110
+ var publisherNumericOk = {
1111
+ bidder: BIDDER_CODE,
1112
+ params: {
1113
+ placementId: '1234567890',
1114
+ publisherId: 123456789012,
1115
+ siteId: '1234567890'
1116
+ }
1117
+ };
1118
+ it('should validate publisherId being 12 digits', function () {
1119
+ expect(spec.isBidRequestValid(publisherNumericOk)).to.equal(true);
1120
+ });
1121
+ var xEmptyPublisher = {
1122
+ bidder: BIDDER_CODE,
1123
+ params: {
1124
+ placementId: '1234567890',
1125
+ publisherId: '',
1126
+ siteId: '1234567890'
1127
+ }
1128
+ };
1129
+ it('should not validate empty publisherId', function () {
1130
+ expect(spec.isBidRequestValid(xEmptyPublisher)).to.equal(false);
1131
+ });
1132
+ var xBadSite = {
1133
+ bidder: BIDDER_CODE,
1134
+ params: {
1135
+ placementId: '1234567890',
1136
+ publisherId: '9876abcd12-3',
1137
+ siteId: '12345Z'
1138
+ }
1139
+ };
1140
+ it('should not validate bad siteId', function () {
1141
+ expect(spec.isBidRequestValid(xBadSite)).to.equal(false);
1142
+ });
1143
+ it('should not validate siteId too long', function () {
1144
+ expect(spec.isBidRequestValid(xBadSite)).to.equal(false);
1145
+ });
1146
+ it('should not validate siteId too short', function () {
1147
+ expect(spec.isBidRequestValid(xBadSite)).to.equal(false);
1148
+ });
1149
+ var allNonStrings = {
1150
+ bidder: BIDDER_CODE,
1151
+ params: {
1152
+ placementId: 1234567890,
1153
+ publisherId: '9876abcd12-3',
1154
+ siteId: 1234567890
1155
+ }
1156
+ };
1157
+ it('should validate all numeric values being sent as non-string numbers', function () {
1158
+ expect(spec.isBidRequestValid(allNonStrings)).to.equal(true);
1159
+ });
1160
+ var emptySiteId = {
1161
+ bidder: BIDDER_CODE,
1162
+ params: {
1163
+ placementId: 1234567890,
1164
+ publisherId: '9876abcd12-3',
1165
+ siteId: ''
1166
+ }
1167
+ };
1168
+ it('should not validate siteId being empty string (it is required now)', function () {
1169
+ expect(spec.isBidRequestValid(emptySiteId)).to.equal(false);
1170
+ });
1171
+ var xBadCustomData = {
1172
+ bidder: BIDDER_CODE,
1173
+ params: {
1174
+ 'placementId': '1234567890',
1175
+ 'publisherId': '9876abcd12-3',
1176
+ 'siteId': '1234567890',
1177
+ 'customData': 'this aint gonna work'
1178
+ }
1179
+ };
1180
+ it('should not validate customData not being an array', function () {
1181
+ expect(spec.isBidRequestValid(xBadCustomData)).to.equal(false);
1182
+ });
1183
+ var xBadCustomDataOldCustomdataValue = {
1184
+ bidder: BIDDER_CODE,
1185
+ params: {
1186
+ 'placementId': '1234567890',
1187
+ 'publisherId': '9876abcd12-3',
1188
+ 'siteId': '1234567890',
1189
+ 'customData': {'gender': 'bart', 'age': 'low'}
1190
+ }
1191
+ };
1192
+ it('should not validate customData being an object, not an array', function () {
1193
+ expect(spec.isBidRequestValid(xBadCustomDataOldCustomdataValue)).to.equal(false);
1194
+ });
1195
+ var xBadCustomDataZerocd = {
1196
+ bidder: BIDDER_CODE,
1197
+ params: {
1198
+ 'placementId': '1111111110',
1199
+ 'publisherId': '9876abcd12-3',
1200
+ 'siteId': '1234567890',
1201
+ 'customData': []
1202
+ }
1203
+ };
1204
+ it('should not validate customData array having no elements', function () {
1205
+ expect(spec.isBidRequestValid(xBadCustomDataZerocd)).to.equal(false);
1206
+ });
1207
+ var xBadCustomDataNotargeting = {
1208
+ bidder: BIDDER_CODE,
1209
+ params: {
1210
+ 'placementId': '1234567890',
1211
+ 'publisherId': '9876abcd12-3',
1212
+ 'customData': [{'settings': {}, 'xx': {'gender': 'bart', 'age': 'low'}}],
1213
+ siteId: '1234567890'
1214
+ }
1215
+ };
1216
+ it('should not validate customData[] having no "targeting"', function () {
1217
+ expect(spec.isBidRequestValid(xBadCustomDataNotargeting)).to.equal(false);
1218
+ });
1219
+ var xBadCustomDataTgtNotObj = {
1220
+ bidder: BIDDER_CODE,
1221
+ params: {
1222
+ 'placementId': '1234567890',
1223
+ 'publisherId': '9876abcd12-3',
1224
+ 'customData': [{'settings': {}, 'targeting': 'this should be an object'}],
1225
+ siteId: '1234567890'
1226
+ }
1227
+ };
1228
+ it('should not validate customData[0].targeting not being an object', function () {
1229
+ expect(spec.isBidRequestValid(xBadCustomDataTgtNotObj)).to.equal(false);
1230
+ });
1231
+ var xBadCustomParams = {
1232
+ bidder: BIDDER_CODE,
1233
+ params: {
1234
+ 'placementId': '1234567890',
1235
+ 'publisherId': '9876abcd12-3',
1236
+ 'siteId': '1234567890',
1237
+ 'customParams': 'this key is no longer valid'
1238
+ }
1239
+ };
1240
+ it('should not validate customParams - this is a renamed key', function () {
1241
+ expect(spec.isBidRequestValid(xBadCustomParams)).to.equal(false);
1242
+ });
1243
+ });
1244
+ describe('buildRequests', function () {
1245
+ it('sends bid request to NEWSPASSURI via POST', function () {
1246
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1247
+ expect(request.url).to.equal(NEWSPASSURI);
1248
+ expect(request.method).to.equal('POST');
1249
+ });
1250
+ it('sends data as a string', function () {
1251
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1252
+ expect(request.data).to.be.a('string');
1253
+ });
1254
+ it('sends all bid parameters', function () {
1255
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1256
+ expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
1257
+ });
1258
+ it('adds all parameters inside the ext object only', function () {
1259
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1260
+ expect(request.data).to.be.a('string');
1261
+ var data = JSON.parse(request.data);
1262
+ expect(data.imp[0].ext.newspassid.customData).to.be.an('array');
1263
+ expect(request).not.to.have.key('lotameData');
1264
+ expect(request).not.to.have.key('customData');
1265
+ });
1266
+ it('adds all parameters inside the ext object only - lightning', function () {
1267
+ let localBidReq = JSON.parse(JSON.stringify(validBidRequests));
1268
+ const request = spec.buildRequests(localBidReq, validBidderRequest);
1269
+ expect(request.data).to.be.a('string');
1270
+ var data = JSON.parse(request.data);
1271
+ expect(data.imp[0].ext.newspassid.customData).to.be.an('array');
1272
+ expect(request).not.to.have.key('lotameData');
1273
+ expect(request).not.to.have.key('customData');
1274
+ });
1275
+ it('has correct bidder', function () {
1276
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1277
+ expect(request.bidderRequest.bids[0].bidder).to.equal(BIDDER_CODE);
1278
+ });
1279
+ it('handles mediaTypes element correctly', function () {
1280
+ const request = spec.buildRequests(validBidRequestsWithBannerMediaType, validBidderRequest);
1281
+ expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
1282
+ });
1283
+ it('handles no newspassid or custom data', function () {
1284
+ const request = spec.buildRequests(validBidRequestsMinimal, validBidderRequest);
1285
+ expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
1286
+ });
1287
+ it('should not crash when there is no sizes element at all', function () {
1288
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
1289
+ expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
1290
+ });
1291
+ it('should be able to handle non-single requests', function () {
1292
+ config.setConfig({'newspassid': {'singleRequest': false}});
1293
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
1294
+ expect(request).to.be.a('array');
1295
+ expect(request[0]).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
1296
+ config.setConfig({'newspassid': {'singleRequest': true}});
1297
+ });
1298
+ it('should not have imp[N].ext.newspassid.userId', function () {
1299
+ let bidderRequest = validBidderRequest;
1300
+ let bidRequests = validBidRequests;
1301
+ bidRequests[0]['userId'] = {
1302
+ 'digitrustid': {data: {id: 'DTID', keyv: 4, privacy: {optout: false}, producer: 'ABC', version: 2}},
1303
+ 'id5id': { uid: '1111', ext: { linkType: 2, abTestingControlGroup: false } },
1304
+ 'idl_env': '3333',
1305
+ 'parrableid': 'eidVersion.encryptionKeyReference.encryptedValue',
1306
+ 'pubcid': '5555',
1307
+ 'tdid': '6666',
1308
+ 'sharedid': {'id': '01EAJWWNEPN3CYMM5N8M5VXY22', 'third': '01EAJWWNEPN3CYMM5N8M5VXY22'}
1309
+ };
1310
+ bidRequests[0]['userIdAsEids'] = validBidRequestsWithUserIdData[0]['userIdAsEids'];
1311
+ const request = spec.buildRequests(bidRequests, bidderRequest);
1312
+ const payload = JSON.parse(request.data);
1313
+ let firstBid = payload.imp[0].ext.newspassid;
1314
+ expect(firstBid).to.not.have.property('userId');
1315
+ delete validBidRequests[0].userId; // tidy up now, else it will screw with other tests
1316
+ });
1317
+ it('should pick up the value of pubcid when built using the pubCommonId module (not userId)', function () {
1318
+ let bidRequests = validBidRequests;
1319
+ bidRequests[0]['userId'] = {
1320
+ 'digitrustid': {data: {id: 'DTID', keyv: 4, privacy: {optout: false}, producer: 'ABC', version: 2}},
1321
+ 'id5id': { uid: '1111', ext: { linkType: 2, abTestingControlGroup: false } },
1322
+ 'idl_env': '3333',
1323
+ 'parrableid': 'eidVersion.encryptionKeyReference.encryptedValue',
1324
+ 'tdid': '6666',
1325
+ 'sharedid': {'id': '01EAJWWNEPN3CYMM5N8M5VXY22', 'third': '01EAJWWNEPN3CYMM5N8M5VXY22'}
1326
+ };
1327
+ bidRequests[0]['userIdAsEids'] = validBidRequestsWithUserIdData[0]['userIdAsEids'];
1328
+ const request = spec.buildRequests(bidRequests, validBidderRequest);
1329
+ const payload = JSON.parse(request.data);
1330
+ expect(payload.ext.newspassid.pubcid).to.equal(bidRequests[0]['crumbs']['pubcid']);
1331
+ delete validBidRequests[0].userId; // tidy up now, else it will screw with other tests
1332
+ });
1333
+ it('should add a user.ext.eids object to contain user ID data in the new location (Nov 2019) Updated Aug 2020', function() {
1334
+ const request = spec.buildRequests(validBidRequestsWithUserIdData, validBidderRequest);
1335
+ const payload = JSON.parse(request.data);
1336
+ expect(payload.user).to.exist;
1337
+ expect(payload.user.ext).to.exist;
1338
+ expect(payload.user.ext.eids).to.exist;
1339
+ expect(payload.user.ext.eids[0]['source']).to.equal('pubcid.org');
1340
+ expect(payload.user.ext.eids[0]['uids'][0]['id']).to.equal('12345678');
1341
+ expect(payload.user.ext.eids[1]['source']).to.equal('adserver.org');
1342
+ expect(payload.user.ext.eids[1]['uids'][0]['id']).to.equal('1111tdid');
1343
+ expect(payload.user.ext.eids[2]['source']).to.equal('id5-sync.com');
1344
+ expect(payload.user.ext.eids[2]['uids'][0]['id']).to.equal('ID5-someId');
1345
+ expect(payload.user.ext.eids[3]['source']).to.equal('criteoId');
1346
+ expect(payload.user.ext.eids[3]['uids'][0]['id']).to.equal('1111criteoId');
1347
+ expect(payload.user.ext.eids[4]['source']).to.equal('idl_env');
1348
+ expect(payload.user.ext.eids[4]['uids'][0]['id']).to.equal('liverampId');
1349
+ expect(payload.user.ext.eids[5]['source']).to.equal('lipb');
1350
+ expect(payload.user.ext.eids[5]['uids'][0]['id']['lipbid']).to.equal('lipbidId123');
1351
+ expect(payload.user.ext.eids[6]['source']).to.equal('parrableId');
1352
+ expect(payload.user.ext.eids[6]['uids'][0]['id']['eid']).to.equal('01.5678.parrableid');
1353
+ });
1354
+ it('replaces the auction url for a config override', function () {
1355
+ spec.propertyBag.config = null;
1356
+ let fakeOrigin = 'http://sometestendpoint';
1357
+ config.setConfig({'newspassid': {'endpointOverride': {'origin': fakeOrigin}}});
1358
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1359
+ expect(request.url).to.equal(fakeOrigin + '/openrtb2/auction');
1360
+ expect(request.method).to.equal('POST');
1361
+ const data = JSON.parse(request.data);
1362
+ expect(data.ext.newspassid.origin).to.equal(fakeOrigin);
1363
+ config.setConfig({'newspassid': {'kvpPrefix': null, 'endpointOverride': null}});
1364
+ });
1365
+ it('replaces the FULL auction url for a config override', function () {
1366
+ spec.propertyBag.config = null;
1367
+ let fakeurl = 'http://sometestendpoint/myfullurl';
1368
+ config.setConfig({'newspassid': {'endpointOverride': {'auctionUrl': fakeurl}}});
1369
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1370
+ expect(request.url).to.equal(fakeurl);
1371
+ expect(request.method).to.equal('POST');
1372
+ const data = JSON.parse(request.data);
1373
+ expect(data.ext.newspassid.origin).to.equal(fakeurl);
1374
+ config.setConfig({'newspassid': {'kvpPrefix': null, 'endpointOverride': null}});
1375
+ });
1376
+ it('should ignore kvpPrefix', function () {
1377
+ spec.propertyBag.config = null;
1378
+ config.setConfig({'newspassid': {'kvpPrefix': 'np'}});
1379
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1380
+ const result = spec.interpretResponse(validResponse, request);
1381
+ expect(result[0].adserverTargeting).to.have.own.property('np_appnexus_crid');
1382
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_crid')).to.equal('98493581');
1383
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_adId')).to.equal('2899ec066a91ff8-0-np-0');
1384
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_size')).to.equal('300x600');
1385
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_pb_r')).to.equal('0.50');
1386
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_bid')).to.equal('true');
1387
+ config.resetConfig();
1388
+ });
1389
+ it('should create a meta object on each bid returned', function () {
1390
+ spec.propertyBag.config = null;
1391
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1392
+ const result = spec.interpretResponse(validResponse, request);
1393
+ expect(result[0]).to.have.own.property('meta');
1394
+ expect(result[0].meta.advertiserDomains[0]).to.equal('http://prebid.org');
1395
+ config.resetConfig();
1396
+ });
1397
+ it('should use nptestmode GET value if set', function() {
1398
+ var specMock = utils.deepClone(spec);
1399
+ specMock.getGetParametersAsObject = function() {
1400
+ return {'nptestmode': 'mytestvalue_123'};
1401
+ };
1402
+ const request = specMock.buildRequests(validBidRequests, validBidderRequest);
1403
+ const data = JSON.parse(request.data);
1404
+ expect(data.imp[0].ext.newspassid.customData).to.be.an('array');
1405
+ expect(data.imp[0].ext.newspassid.customData[0].targeting.nptestmode).to.equal('mytestvalue_123');
1406
+ });
1407
+ it('should pass through GET params if present: npf, nppf, nprp, npip', function() {
1408
+ var specMock = utils.deepClone(spec);
1409
+ specMock.getGetParametersAsObject = function() {
1410
+ return {npf: '1', nppf: '0', nprp: '2', npip: '123'};
1411
+ };
1412
+ const request = specMock.buildRequests(validBidRequests, validBidderRequest);
1413
+ const data = JSON.parse(request.data);
1414
+ expect(data.ext.newspassid.npf).to.equal(1);
1415
+ expect(data.ext.newspassid.nppf).to.equal(0);
1416
+ expect(data.ext.newspassid.nprp).to.equal(2);
1417
+ expect(data.ext.newspassid.npip).to.equal(123);
1418
+ });
1419
+ it('should pass through GET params if present: npf, nppf, nprp, npip with alternative values', function() {
1420
+ var specMock = utils.deepClone(spec);
1421
+ specMock.getGetParametersAsObject = function() {
1422
+ return {npf: 'false', nppf: 'true', nprp: 'xyz', npip: 'hello'};
1423
+ };
1424
+ const request = specMock.buildRequests(validBidRequests, validBidderRequest);
1425
+ const data = JSON.parse(request.data);
1426
+ expect(data.ext.newspassid.npf).to.equal(0);
1427
+ expect(data.ext.newspassid.nppf).to.equal(1);
1428
+ expect(data.ext.newspassid).to.not.haveOwnProperty('nprp');
1429
+ expect(data.ext.newspassid).to.not.haveOwnProperty('npip');
1430
+ });
1431
+ it('should use nptestmode GET value if set, even if there is no customdata in config', function() {
1432
+ var specMock = utils.deepClone(spec);
1433
+ specMock.getGetParametersAsObject = function() {
1434
+ return {'nptestmode': 'mytestvalue_123'};
1435
+ };
1436
+ const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
1437
+ const data = JSON.parse(request.data);
1438
+ expect(data.imp[0].ext.newspassid.customData).to.be.an('array');
1439
+ expect(data.imp[0].ext.newspassid.customData[0].targeting.nptestmode).to.equal('mytestvalue_123');
1440
+ });
1441
+ it('should use GET values auction=[encoded URL] & cookiesync=[encoded url] if set', function() {
1442
+ spec.propertyBag.config = null;
1443
+ var specMock = utils.deepClone(spec);
1444
+ specMock.getGetParametersAsObject = function() {
1445
+ return {};
1446
+ };
1447
+ let request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
1448
+ let url = request.url;
1449
+ expect(url).to.equal('https://bidder.newspassid.com/openrtb2/auction');
1450
+ let cookieUrl = specMock.getCookieSyncUrl();
1451
+ expect(cookieUrl).to.equal('https://bidder.newspassid.com/static/load-cookie.html');
1452
+ specMock = utils.deepClone(spec);
1453
+ specMock.getGetParametersAsObject = function() {
1454
+ return {'auction': 'https://www.someurl.com/auction', 'cookiesync': 'https://www.someurl.com/sync'};
1455
+ };
1456
+ request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
1457
+ url = request.url;
1458
+ expect(url).to.equal('https://www.someurl.com/auction');
1459
+ cookieUrl = specMock.getCookieSyncUrl();
1460
+ expect(cookieUrl).to.equal('https://www.someurl.com/sync');
1461
+ });
1462
+ it('should use a valid npstoredrequest GET value if set to override the placementId values, and set np_rw if we find it', function() {
1463
+ var specMock = utils.deepClone(spec);
1464
+ specMock.getGetParametersAsObject = function() {
1465
+ return {'npstoredrequest': '1122334455'}; // 10 digits are valid
1466
+ };
1467
+ const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
1468
+ const data = JSON.parse(request.data);
1469
+ expect(data.ext.newspassid.np_rw).to.equal(1);
1470
+ expect(data.imp[0].ext.prebid.storedrequest.id).to.equal('1122334455');
1471
+ });
1472
+ it('should NOT use an invalid npstoredrequest GET value if set to override the placementId values, and set np_rw to 0', function() {
1473
+ var specMock = utils.deepClone(spec);
1474
+ specMock.getGetParametersAsObject = function() {
1475
+ return {'npstoredrequest': 'BADVAL'}; // 10 digits are valid
1476
+ };
1477
+ const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
1478
+ const data = JSON.parse(request.data);
1479
+ expect(data.ext.newspassid.np_rw).to.equal(0);
1480
+ expect(data.imp[0].ext.prebid.storedrequest.id).to.equal('1310000099');
1481
+ });
1482
+ it('should pick up the config value of coppa & set it in the request', function () {
1483
+ config.setConfig({'coppa': true});
1484
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
1485
+ const payload = JSON.parse(request.data);
1486
+ expect(payload.regs).to.include.keys('coppa');
1487
+ expect(payload.regs.coppa).to.equal(1);
1488
+ config.resetConfig();
1489
+ });
1490
+ it('should pick up the config value of coppa & only set it in the request if its true', function () {
1491
+ config.setConfig({'coppa': false});
1492
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
1493
+ const payload = JSON.parse(request.data);
1494
+ expect(utils.deepAccess(payload, 'regs.coppa')).to.be.undefined;
1495
+ config.resetConfig();
1496
+ });
1497
+ it('should should contain a unique page view id in the auction request which persists across calls', function () {
1498
+ let request = spec.buildRequests(validBidRequests, validBidderRequest);
1499
+ let payload = JSON.parse(request.data);
1500
+ expect(utils.deepAccess(payload, 'ext.newspassid.pv')).to.be.a('string');
1501
+ request = spec.buildRequests(validBidRequestsIsThisCamelCaseEnough, validBidderRequest);
1502
+ let payload2 = JSON.parse(request.data);
1503
+ expect(utils.deepAccess(payload2, 'ext.newspassid.pv')).to.be.a('string');
1504
+ expect(utils.deepAccess(payload2, 'ext.newspassid.pv')).to.equal(utils.deepAccess(payload, 'ext.newspassid.pv'));
1505
+ });
1506
+ it('should indicate that the whitelist was used when it contains valid data', function () {
1507
+ config.setConfig({'newspassid': {'np_whitelist_adserver_keys': ['np_appnexus_pb', 'np_appnexus_imp_id']}});
1508
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1509
+ const payload = JSON.parse(request.data);
1510
+ expect(payload.ext.newspassid.np_kvp_rw).to.equal(1);
1511
+ config.resetConfig();
1512
+ });
1513
+ it('should indicate that the whitelist was not used when it contains no data', function () {
1514
+ config.setConfig({'newspassid': {'np_whitelist_adserver_keys': []}});
1515
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1516
+ const payload = JSON.parse(request.data);
1517
+ expect(payload.ext.newspassid.np_kvp_rw).to.equal(0);
1518
+ config.resetConfig();
1519
+ });
1520
+ it('should indicate that the whitelist was not used when it is not set in the config', function () {
1521
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1522
+ const payload = JSON.parse(request.data);
1523
+ expect(payload.ext.newspassid.np_kvp_rw).to.equal(0);
1524
+ });
1525
+ it('should handle ortb2 site data', function () {
1526
+ let bidderRequest = JSON.parse(JSON.stringify(validBidderRequest));
1527
+ bidderRequest.ortb2 = {
1528
+ 'site': {
1529
+ 'name': 'example_ortb2_name',
1530
+ 'domain': 'page.example.com',
1531
+ 'cat': ['IAB2'],
1532
+ 'sectioncat': ['IAB2-2'],
1533
+ 'pagecat': ['IAB2-2'],
1534
+ 'page': 'https://page.example.com/here.html',
1535
+ 'ref': 'https://ref.example.com',
1536
+ 'keywords': 'power tools, drills',
1537
+ 'search': 'drill'
1538
+ }
1539
+ };
1540
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
1541
+ const payload = JSON.parse(request.data);
1542
+ expect(payload.imp[0].ext.newspassid.customData[0].targeting.name).to.equal('example_ortb2_name');
1543
+ expect(payload.user.ext).to.not.have.property('gender');
1544
+ });
1545
+ it('should add ortb2 site data when there is no customData already created', function () {
1546
+ let bidderRequest = JSON.parse(JSON.stringify(validBidderRequest));
1547
+ bidderRequest.ortb2 = {
1548
+ 'site': {
1549
+ 'name': 'example_ortb2_name',
1550
+ 'domain': 'page.example.com',
1551
+ 'cat': ['IAB2'],
1552
+ 'sectioncat': ['IAB2-2'],
1553
+ 'pagecat': ['IAB2-2'],
1554
+ 'page': 'https://page.example.com/here.html',
1555
+ 'ref': 'https://ref.example.com',
1556
+ 'keywords': 'power tools, drills',
1557
+ 'search': 'drill'
1558
+ }
1559
+ };
1560
+ const request = spec.buildRequests(validBidRequestsNoCustomData, bidderRequest);
1561
+ const payload = JSON.parse(request.data);
1562
+ expect(payload.imp[0].ext.newspassid.customData[0].targeting.name).to.equal('example_ortb2_name');
1563
+ expect(payload.imp[0].ext.newspassid.customData[0].targeting).to.not.have.property('gender')
1564
+ });
1565
+ it('should add ortb2 user data to the user object', function () {
1566
+ let bidderRequest = JSON.parse(JSON.stringify(validBidderRequest));
1567
+ bidderRequest.ortb2 = {
1568
+ 'user': {
1569
+ 'gender': 'I identify as a box of rocks'
1570
+ }
1571
+ };
1572
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
1573
+ const payload = JSON.parse(request.data);
1574
+ expect(payload.user.gender).to.equal('I identify as a box of rocks');
1575
+ });
1576
+ it('handles schain object in each bidrequest (will be the same in each br)', function () {
1577
+ let br = JSON.parse(JSON.stringify(validBidRequests));
1578
+ let schainConfigObject = {
1579
+ 'ver': '1.0',
1580
+ 'complete': 1,
1581
+ 'nodes': [
1582
+ {
1583
+ 'asi': 'bidderA.com',
1584
+ 'sid': '00001',
1585
+ 'hp': 1
1586
+ }
1587
+ ]
1588
+ };
1589
+ br[0]['schain'] = schainConfigObject;
1590
+ const request = spec.buildRequests(br, validBidderRequest);
1591
+ const data = JSON.parse(request.data);
1592
+ expect(data.source.ext).to.haveOwnProperty('schain');
1593
+ expect(data.source.ext.schain).to.deep.equal(schainConfigObject); // .deep.equal() : Target object deeply (but not strictly) equals `{a: 1}`
1594
+ });
1595
+ });
1596
+ describe('interpretResponse', function () {
1597
+ it('should build bid array', function () {
1598
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1599
+ const result = spec.interpretResponse(validResponse, request);
1600
+ expect(result.length).to.equal(1);
1601
+ });
1602
+ it('should have all relevant fields', function () {
1603
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1604
+ const result = spec.interpretResponse(validResponse, request);
1605
+ const bid = result[0];
1606
+ expect(bid.cpm).to.equal(validResponse.body.seatbid[0].bid[0].cpm);
1607
+ expect(bid.width).to.equal(validResponse.body.seatbid[0].bid[0].width);
1608
+ expect(bid.height).to.equal(validResponse.body.seatbid[0].bid[0].height);
1609
+ });
1610
+ it('should build bid array with usp/CCPA', function () {
1611
+ let validBR = JSON.parse(JSON.stringify(validBidderRequest));
1612
+ validBR.uspConsent = '1YNY';
1613
+ const request = spec.buildRequests(validBidRequests, validBR);
1614
+ const payload = JSON.parse(request.data);
1615
+ expect(payload.user.ext.uspConsent).not.to.exist;
1616
+ expect(payload.regs.ext.us_privacy).to.equal('1YNY');
1617
+ });
1618
+ it('should fail ok if no seatbid in server response', function () {
1619
+ const result = spec.interpretResponse({}, {});
1620
+ expect(result).to.be.an('array');
1621
+ expect(result).to.be.empty;
1622
+ });
1623
+ it('should fail ok if seatbid is not an array', function () {
1624
+ const result = spec.interpretResponse({'body': {'seatbid': 'nothing_here'}}, {});
1625
+ expect(result).to.be.an('array');
1626
+ expect(result).to.be.empty;
1627
+ });
1628
+ it('should correctly parse response where there are more bidders than ad slots', function () {
1629
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1630
+ const result = spec.interpretResponse(validBidResponse1adWith2Bidders, request);
1631
+ expect(result.length).to.equal(2);
1632
+ });
1633
+ it('should have a ttl of 600', function () {
1634
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1635
+ const result = spec.interpretResponse(validResponse, request);
1636
+ expect(result[0].ttl).to.equal(300);
1637
+ });
1638
+ it('should handle a valid whitelist, removing items not on the list & leaving others', function () {
1639
+ config.setConfig({'newspassid': {'np_whitelist_adserver_keys': ['np_appnexus_crid', 'np_appnexus_adId']}});
1640
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1641
+ const result = spec.interpretResponse(validResponse, request);
1642
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_adv')).to.be.undefined;
1643
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_adId')).to.equal('2899ec066a91ff8-0-np-0');
1644
+ config.resetConfig();
1645
+ });
1646
+ it('should ignore a whitelist if enhancedAdserverTargeting is false', function () {
1647
+ config.setConfig({'newspassid': {'np_whitelist_adserver_keys': ['np_appnexus_crid', 'np_appnexus_imp_id'], 'enhancedAdserverTargeting': false}});
1648
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1649
+ const result = spec.interpretResponse(validResponse, request);
1650
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_adv')).to.be.undefined;
1651
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_imp_id')).to.be.undefined;
1652
+ config.resetConfig();
1653
+ });
1654
+ it('should correctly handle enhancedAdserverTargeting being false', function () {
1655
+ config.setConfig({'newspassid': {'enhancedAdserverTargeting': false}});
1656
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1657
+ const result = spec.interpretResponse(validResponse, request);
1658
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_adv')).to.be.undefined;
1659
+ expect(utils.deepAccess(result[0].adserverTargeting, 'np_appnexus_imp_id')).to.be.undefined;
1660
+ config.resetConfig();
1661
+ });
1662
+ it('should add unique adId values to each bid', function() {
1663
+ const request = spec.buildRequests(validBidRequests, validBidderRequest);
1664
+ let validres = JSON.parse(JSON.stringify(validResponse2BidsSameAdunit));
1665
+ const result = spec.interpretResponse(validres, request);
1666
+ expect(result.length).to.equal(1);
1667
+ expect(result[0]['price']).to.equal(0.9);
1668
+ expect(result[0]['adserverTargeting']['np_npappnexus_adId']).to.equal('2899ec066a91ff8-0-np-1');
1669
+ });
1670
+ it('should correctly process an auction with 2 adunits & multiple bidders one of which bids for both adslots', function() {
1671
+ let validres = JSON.parse(JSON.stringify(multiResponse1));
1672
+ let request = spec.buildRequests(multiRequest1, multiBidderRequest1.bidderRequest);
1673
+ let result = spec.interpretResponse(validres, request);
1674
+ expect(result.length).to.equal(4); // one of the 5 bids will have been removed
1675
+ expect(result[1]['price']).to.equal(0.521);
1676
+ expect(result[1]['impid']).to.equal('3025f169863b7f8');
1677
+ expect(result[1]['id']).to.equal('18552976939844999');
1678
+ expect(result[1]['adserverTargeting']['np_npappnexus_adId']).to.equal('3025f169863b7f8-0-np-2');
1679
+ validres = JSON.parse(JSON.stringify(multiResponse1));
1680
+ validres.body.seatbid[0].bid[1].price = 1.1;
1681
+ validres.body.seatbid[0].bid[1].cpm = 1.1;
1682
+ request = spec.buildRequests(multiRequest1, multiBidderRequest1.bidderRequest);
1683
+ result = spec.interpretResponse(validres, request);
1684
+ expect(result[1]['price']).to.equal(1.1);
1685
+ expect(result[1]['impid']).to.equal('3025f169863b7f8');
1686
+ expect(result[1]['id']).to.equal('18552976939844681');
1687
+ expect(result[1]['adserverTargeting']['np_npappnexus_adId']).to.equal('3025f169863b7f8-0-np-1');
1688
+ });
1689
+ });
1690
+ describe('userSyncs', function () {
1691
+ it('should fail gracefully if no server response', function () {
1692
+ const result = spec.getUserSyncs('bad', false, emptyObject);
1693
+ expect(result).to.be.empty;
1694
+ });
1695
+ it('should fail gracefully if server response is empty', function () {
1696
+ const result = spec.getUserSyncs('bad', [], emptyObject);
1697
+ expect(result).to.be.empty;
1698
+ });
1699
+ it('should append the various values if they exist', function() {
1700
+ spec.buildRequests(validBidRequests, validBidderRequest);
1701
+ const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', emptyObject);
1702
+ expect(result).to.be.an('array');
1703
+ expect(result[0].url).to.include('publisherId=9876abcd12-3');
1704
+ expect(result[0].url).to.include('siteId=1234567890');
1705
+ });
1706
+ it('should append ccpa (usp data)', function() {
1707
+ spec.buildRequests(validBidRequests, validBidderRequest);
1708
+ const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', emptyObject, '1YYN');
1709
+ expect(result).to.be.an('array');
1710
+ expect(result[0].url).to.include('usp_consent=1YYN');
1711
+ });
1712
+ it('should use "" if no usp is sent to cookieSync', function() {
1713
+ spec.buildRequests(validBidRequests, validBidderRequest);
1714
+ const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', emptyObject);
1715
+ expect(result).to.be.an('array');
1716
+ expect(result[0].url).to.include('usp_consent=&');
1717
+ });
1718
+ });
1719
+ describe('default size', function () {
1720
+ it('should should return default sizes if no obj is sent', function () {
1721
+ let obj = '';
1722
+ const result = defaultSize(obj);
1723
+ expect(result.defaultHeight).to.equal(250);
1724
+ expect(result.defaultWidth).to.equal(300);
1725
+ });
1726
+ });
1727
+ describe('getGranularityKeyName', function() {
1728
+ it('should return a string granularity as-is', function() {
1729
+ const result = getGranularityKeyName('', 'this is it', '');
1730
+ expect(result).to.equal('this is it');
1731
+ });
1732
+ it('should return "custom" for a mediaTypeGranularity object', function() {
1733
+ const result = getGranularityKeyName('', {}, '');
1734
+ expect(result).to.equal('custom');
1735
+ });
1736
+ it('should return "custom" for a mediaTypeGranularity object', function() {
1737
+ const result = getGranularityKeyName('', false, 'string buckets');
1738
+ expect(result).to.equal('string buckets');
1739
+ });
1740
+ });
1741
+ describe('getGranularityObject', function() {
1742
+ it('should return an object as-is', function() {
1743
+ const result = getGranularityObject('', {'name': 'mark'}, '', '');
1744
+ expect(result.name).to.equal('mark');
1745
+ });
1746
+ it('should return an object as-is', function() {
1747
+ const result = getGranularityObject('', false, 'custom', {'name': 'rupert'});
1748
+ expect(result.name).to.equal('rupert');
1749
+ });
1750
+ });
1751
+ describe('blockTheRequest', function() {
1752
+ it('should return true if np_request is false', function() {
1753
+ config.setConfig({'newspassid': {'np_request': false}});
1754
+ let result = spec.blockTheRequest();
1755
+ expect(result).to.be.true;
1756
+ config.resetConfig();
1757
+ });
1758
+ it('should return false if np_request is true', function() {
1759
+ config.setConfig({'newspassid': {'np_request': true}});
1760
+ let result = spec.blockTheRequest();
1761
+ expect(result).to.be.false;
1762
+ config.resetConfig();
1763
+ });
1764
+ });
1765
+ describe('getPageId', function() {
1766
+ it('should return the same Page ID for multiple calls', function () {
1767
+ let result = spec.getPageId();
1768
+ expect(result).to.be.a('string');
1769
+ let result2 = spec.getPageId();
1770
+ expect(result2).to.equal(result);
1771
+ });
1772
+ });
1773
+ describe('getBidRequestForBidId', function() {
1774
+ it('should locate a bid inside a bid array', function () {
1775
+ let result = spec.getBidRequestForBidId('2899ec066a91ff8', validBidRequestsMulti);
1776
+ expect(result.testId).to.equal(1);
1777
+ result = spec.getBidRequestForBidId('2899ec066a91ff0', validBidRequestsMulti);
1778
+ expect(result.testId).to.equal(2);
1779
+ });
1780
+ });
1781
+ describe('removeSingleBidderMultipleBids', function() {
1782
+ it('should remove the multi bid by npappnexus for adslot 2d30e86db743a8', function() {
1783
+ let validres = JSON.parse(JSON.stringify(multiResponse1));
1784
+ expect(validres.body.seatbid[0].bid.length).to.equal(3);
1785
+ expect(validres.body.seatbid[0].seat).to.equal('npappnexus');
1786
+ let response = spec.removeSingleBidderMultipleBids(validres.body.seatbid);
1787
+ expect(response.length).to.equal(2);
1788
+ expect(response[0].bid.length).to.equal(2);
1789
+ expect(response[0].seat).to.equal('npappnexus');
1790
+ expect(response[1].bid.length).to.equal(2);
1791
+ });
1792
+ });
1793
+ });