• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

prebid / Prebid.js / 16621163569

30 Jul 2025 11:22AM UTC coverage: 96.257% (-0.005%) from 96.262%
16621163569

push

github

web-flow
fix video player size (#13691)

39380 of 48412 branches covered (81.34%)

9 of 9 new or added lines in 2 files covered. (100.0%)

32 existing lines in 16 files now uncovered.

195047 of 202632 relevant lines covered (96.26%)

83.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.11
/test/spec/modules/buzzoolaBidAdapter_spec.js
1
import {expect} from 'chai';
2
import {spec} from 'modules/buzzoolaBidAdapter.js';
3
import {newBidder} from 'src/adapters/bidderFactory.js';
4
import '../../../src/prebid.js';
5
import {executeRenderer, Renderer} from '../../../src/Renderer.js';
6
import {deepClone} from '../../../src/utils.js';
7

8
const ENDPOINT = 'https://exchange.buzzoola.com/ssp/prebidjs';
1✔
9
const RENDERER_SRC = 'https://tube.buzzoola.com/new/build/buzzlibrary.js';
1✔
10

11
const INVALID_BIDS = [{
1✔
12
  'bidder': 'buzzoola',
13
  'mediaTypes': {'banner': {'sizes': [[240, 400], [300, 600]]}},
14
  'sizes': [[240, 400], [300, 600]]
15
}, {
16
  'bidder': 'buzzoola',
17
  'params': {'placementId': 417846},
18
  'sizes': [[240, 400], [300, 600]]
19
}, {
20
  'bidder': 'buzzoola',
21
  'mediaTypes': {
22
    'video': {
23
      'playerSize': [[640, 380]],
24
      'mimes': ['video/mp4'],
25
      'minduration': 1,
26
      'maxduration': 2
27
    }
28
  }
29
}, {
30
  'bidder': 'buzzoola',
31
  'params': {'placementId': 417845}
32
}];
33

34
const BANNER_BID = {
1✔
35
  'bidder': 'buzzoola',
36
  'params': {'placementId': 417846},
37
  'mediaTypes': {'banner': {'sizes': [[240, 400], [300, 600]]}},
38
  'sizes': [[240, 400], [300, 600]],
39
  'bidId': '2a11641ada3c6a'
40
};
41

42
const BANNER_BID_REQUEST = {
1✔
43
  bidderCode: 'buzzoola',
44
  bids: [BANNER_BID]
45
};
46

47
const BANNER_RESPONSE = [{
1✔
48
  'requestId': '2a11641ada3c6a',
49
  'cpm': 5.583115,
50
  'width': 240,
51
  'height': 400,
52
  'creativeId': '11773',
53
  'dealId': '',
54
  'currency': 'RUB',
55
  'netRevenue': true,
56
  'ttl': 10800,
57
  'ad': '<div id=\"2a11641ada3c6a\"><script>\n(function(w, d){\n\tvar env = \"prod\";\n\tvar playerData = unescape(\"\\u003ca href=\"https://buzzoola.com\" target="_blank"\\u003e\\u003cimg src="https://tube.buzzoola.com/xstatic/o42/buzzoola-test/240x400.jpg" width="240" height="400"/\\u003e\\u003c/a\\u003e\\u003cscript\\u003econsole.log("Im a buzzoola banner!");\\u003c/script\\u003e\");\n\tvar containerId = \"2a11641ada3c6a\";\n\n\tloadScript = function(src, cb){\n\t\tvar s = d.createElement(\"script\");\n\t\ts.onload = function(){cb && cb()};\n\t\ts.onerror = function(){cb && cb(true)};\n\t\ts.src = src;\n\t\ts.async = true;\n\t\td.body.appendChild(s);\n\t};\n\n\tthis.createPlayer = (function(containerId, env, playerData){ return function(){\n\t\tvar p = d.createElement(\"div\");\n\t\tif (env) p.setAttribute(\"data-debug_env\", env);\n\t\tvar container = d.getElementById(containerId)\n\t\tif(container){\n\t\t\tcontainer.appendChild(p);\n\n\t\t\tnew w.Buzzoola.Core(p, {\n\t\t\t\tdata: {\n\t\t\t\t\tcrs: [{\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\tmain_content: playerData,\n\t\t\t\t\t\t\tbanner_height: 400,\n\t\t\t\t\t\t\tbanner_width: 240\n\t\t\t\t\t\t},\n\t\t\t\t\t\tevent_url: \"https://exchange.buzzoola.com/event/398e072c-4987-4745-6e72-109b214a79e0/3fa02874-3d73-48a1-4ba6-2129c6f99e1d/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75R6wziBhL0JAERGosa1adol78sahgLU5t/\",\n\t\t\t\t\t\tcontent_type: \"banner\",\n\t\t\t\t\t\tshare_buttons: [],\n\t\t\t\t\t\tbranding_template: \"\",\n\t\t\t\t\t\tplayer_show_skip_button_seconds: 5,\n\t\t\t\t\t\ttracking_url: {\"ctor\":[\"https://www.tns-counter.ru/V13a****buzzola_com/ru/CP1251/tmsec=buzzola_total/5786980942666966205\",\"https://www.tns-counter.ru/V13a****buzzoola_kz/ru/UTF-8/tmsec=buzzoola_video/3495102609460744232\",\"https://buzzoolaru.solution.weborama.fr/fcgi-bin/dispatch.fcgi?a.A=ev\\u0026a.si=3071\\u0026a.te=37\\u0026a.aap=1\\u0026a.agi=862\\u0026a.evn=PrebidJS.test\\u0026g.ra=7385909726626079306\",\"https://x01.aidata.io/0.gif?pid=BUZZOOLA\\u0026id=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://top-fwz1.mail.ru/counter?id=3026766\",\"https://dm.hybrid.ai/match?id=111\\u0026vid=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://px.adhigh.net/p/cm/buzzoola?u=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://ssp1.rtb.beeline.ru/userbind?src=buz\\u0026ssp_user_id=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://sync.upravel.com/image?source=buzzoola\\u0026id=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://relap.io/api/partners/bzcs.gif?uid=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://x.bidswitch.net/sync?ssp=sspicyads\",\"https://inv-nets.admixer.net/adxcm.aspx?ssp=3C5173FC-CA30-4692-9116-009C19CB1BF9\\u0026rurl=%2F%2Fexchange.buzzoola.com%2Fcookiesync%2Fdsp%2Fadmixer-video%2F%24%24visitor_cookie%24%24\",\"https://sync.datamind.ru/cookie/accepter?source=buzzoola\\u0026id=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://dmp.vihub.ru/match?sysid=buz\\u0026redir=no\\u0026uid=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://ad.adriver.ru/cgi-bin/rle.cgi?sid=1\\u0026ad=608223\\u0026bt=21\\u0026pid=2551979\\u0026bid=6150299\\u0026bn=6150299\\u0026rnd=8725366486107503947\",\"https://reichelcormier.bid/point/?method=match\\u0026type=ssp\\u0026key=4677290772f9000878093d69c199bfba\\u0026id=3509\\u0026extUid=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://sync.republer.com/match?src=buzzoola\\u0026id=dbdb5b13-e719-4987-7f6a-a882322bbfce\",\"https://sm.rtb.mts.ru/p?id=dbdb5b13-e719-4987-7f6a-a882322bbfce\\u0026ssp=buzzoola\",\"https://cm.mgid.com/m?cdsp=371151\\u0026adu=https%3A%2F%2Fexchange.buzzoola.com%2Fcookiesync%2Fdsp%2Fmarketgid-native%2F%7Bmuidn%7D\",\"https://dmp.gotechnology.io/dmp/syncsspdmp?sspid=122258\"]},\n\t\t\t\t\t\ttracking_js: {\"ctor\":[\"https://buzzoola.fraudscore.mobi/dooJ9sheeeDaZ3fe.js?s=268671\\u0026l=417846\"]}\n\t\t\t\t\t}],\n\t\t\t\t\tauction_id: \"398e072c-4987-4745-6e72-109b214a79e0\"\n\t\t        }\n\t\t    });\n\t\t}\n\t}})(containerId, env, playerData)\n\n\tif (w.Buzzoola !== null && w.Buzzoola !== undefined){\n\t\tthis.createPlayer();\n\t} else {\n\t\tloadScript(\"https://tube.buzzoola.com/new/build/buzzlibrary.js\", (function(context){return function(err){\n\t\t\tif (err){\n\t\t\t\t// TODO: error callback\n\t\t\t} else {\n\t\t\t\tcontext.createPlayer();\n\t\t\t}\n\t\t}})(this));\n\t}\n\n}).call({},window, document);\n</script></div>',
58
  'mediaType': 'banner',
59
  'meta': {
60
    'advertiserDomains': [
61
      'buzzoola.com'
62
    ]
63
  }
64
}];
65

66
const REQUIRED_BANNER_FIELDS = [
1✔
67
  'requestId',
68
  'cpm',
69
  'width',
70
  'height',
71
  'ad',
72
  'ttl',
73
  'creativeId',
74
  'netRevenue',
75
  'currency',
76
  'mediaType',
77
  'meta'
78
];
79

80
const VIDEO_BID = {
1✔
81
  'bidder': 'buzzoola',
82
  'params': {'placementId': 417845},
83
  'mediaTypes': {
84
    'video': {
85
      'context': 'instream',
86
      'playerSize': [[640, 380]],
87
      'mimes': ['video/mp4'],
88
      'minduration': 1,
89
      'maxduration': 2
90
    }
91
  },
92
  'bidId': '325a54271dc40a'
93
};
94

95
const VIDEO_BID_REQUEST = {
1✔
96
  bidderCode: 'buzzoola',
97
  bids: [VIDEO_BID]
98
};
99

100
const VIDEO_RESPONSE = [{
1✔
101
  'requestId': '325a54271dc40a',
102
  'cpm': 5.528554074074074,
103
  'width': 640,
104
  'height': 480,
105
  'creativeId': '11774',
106
  'dealId': '',
107
  'currency': 'RUB',
108
  'netRevenue': true,
109
  'ttl': 10800,
110
  'ad': '{"crs":[{"advertiser_id":165,"title":"qa//PrebidJStestVideoURL","description":"qa//PrebidJStest","duration":0,"ya_id":"55038886","raw_content":"{\\"main_content\\": \\"https://tube.buzzoola.com/xstatic/o42/mcaug/2.mp4\\"}","content":{"main_content":"https://tube.buzzoola.com/xstatic/o42/mcaug/2.mp4"},"content_type":"video_url","sponsor_link":"","sponsor_name":"","overlay":"","overlay_start_after":0,"overlay_close_after":0,"action_button_title":"","tracking_url":{},"iframe_domains":[],"soc_share_url":"https://tube.buzzoola.com/share.html","player_show_skip_button_before_play":false,"player_show_skip_button_seconds":5,"player_show_title":true,"player_data_attributes":{"expandable":"default","overroll":"default"},"click_event_view":"default","share_panel_position":"left","auto_play":true,"logo_url":{},"share_buttons":["vkontakte","facebook","twitter","moimir","odnoklassniki","embed"],"player_show_panels":false,"thumbnail":"","tracking_js":{},"click_event_url":"https://exchange.buzzoola.com/event/f9382ceb-49c2-4683-50d8-5c516c53cd69/14795a96-6261-49dc-7241-207333ab1490/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpIERGosa1adogXgqjDml4Pm/click/0/","vpaid_js_url":"https://tube.buzzoola.com/new/js/lib/vpaid_js_proxy.js","skip_clickthru":false,"landing_link_text":"","sound_enabled_by_default":false,"landing_link_position":"right","displayed_price":"","js_wrapper_url":"","enable_moat":false,"branding_template":"","event_url":"https://exchange.buzzoola.com/event/f9382ceb-49c2-4683-50d8-5c516c53cd69/14795a96-6261-49dc-7241-207333ab1490/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpIERGosa1adogXgqjDml4Pm/","resend_event_url":"https://exchange.buzzoola.com/resend_event/f9382ceb-49c2-4683-50d8-5c516c53cd69/14795a96-6261-49dc-7241-207333ab1490/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpIERGosa1adogXgqjDml4Pm/","creative_hash":"m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpIERGosa1adogXgqjDml4Pm","custom_html":"","custom_js":"","height":0,"width":0,"campaign_id":5758,"line_item_id":17319,"creative_id":11774,"extra":{"imp_id":"14795a96-6261-49dc-7241-207333ab1490","rtime":"2019-08-27 13:58:36"},"subcontent":"vast","auction_settings":{"price":"4.6158956756756755","currency":"RUB","event_name":"player_seen","time_slice":0},"hash_to_embed":"kbDH64c7yFYkSu0KCwSkoUD2bNHAnUTHBERqLGtWnaIF4Kow5peD5g","need_ad":false}],"tracking_urls":{"ctor":["https://www.tns-counter.ru/V13a****buzzola_com/ru/CP1251/tmsec=buzzola_total/1322650417245790778","https://www.tns-counter.ru/V13a****buzzoola_kz/ru/UTF-8/tmsec=buzzoola_video/5395765100939533275","https://buzzoolaru.solution.weborama.fr/fcgi-bin/dispatch.fcgi?a.A=ev&a.si=3071&a.te=37&a.aap=1&a.agi=862&a.evn=PrebidJS.test&g.ra=4581478478720298652","https://x01.aidata.io/0.gif?pid=BUZZOOLA&id=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://top-fwz1.mail.ru/counter?id=3026769","https://www.tns-counter.ru/V13a****buzzola_com/ru/UTF-8/tmsec=buzzola_inread/542059452789128996","https://dm.hybrid.ai/match?id=111&vid=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://px.adhigh.net/p/cm/buzzoola?u=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://ssp1.rtb.beeline.ru/userbind?src=buz&ssp_user_id=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://sync.upravel.com/image?source=buzzoola&id=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://relap.io/api/partners/bzcs.gif?uid=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://x.bidswitch.net/sync?ssp=sspicyads","https://inv-nets.admixer.net/adxcm.aspx?ssp=3C5173FC-CA30-4692-9116-009C19CB1BF9&rurl=%2F%2Fexchange.buzzoola.com%2Fcookiesync%2Fdsp%2Fadmixer-video%2F%24%24visitor_cookie%24%24","https://sync.datamind.ru/cookie/accepter?source=buzzoola&id=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://dmp.vihub.ru/match?sysid=buz&redir=no&uid=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://ad.adriver.ru/cgi-bin/rle.cgi?sid=1&ad=608223&bt=21&pid=2551979&bid=6150299&bn=6150299&rnd=1279444531737367663","https://reichelcormier.bid/point/?method=match&type=ssp&key=4677290772f9000878093d69c199bfba&id=3509&extUid=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://sync.republer.com/match?src=buzzoola&id=dbdb5b13-e719-4987-7f6a-a882322bbfce","https://sm.rtb.mts.ru/p?id=dbdb5b13-e719-4987-7f6a-a882322bbfce&ssp=buzzoola","https://cm.mgid.com/m?cdsp=371151&adu=https%3A%2F%2Fexchange.buzzoola.com%2Fcookiesync%2Fdsp%2Fmarketgid-native%2F%7Bmuidn%7D","https://dmp.gotechnology.io/dmp/syncsspdmp?sspid=122258"]},"tracking_js":{"ctor":["https://buzzoola.fraudscore.mobi/dooJ9sheeeDaZ3fe.js?s=268671&l=417845"]},"placement":{"placement_id":417845,"unit_type":"inread","unit_settings":{"align":"left","autoplay_enable_sound":false,"creatives_amount":1,"debug_mode":false,"expandable":"never","sound_control":"default","target":"","width":"100%"},"unit_settings_list":["width","sound_control","debug_mode","target","creatives_amount","expandable","container_height","align","height"]},"uuid":"dbdb5b13-e719-4987-7f6a-a882322bbfce","auction_id":"f9382ceb-49c2-4683-50d8-5c516c53cd69","env":"prod"}',
111
  'vastUrl': 'https://exchange.buzzoola.com/prebid/adm/6cfa2ee1-f001-4fab-5582-a62eaee46205/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75R6wziBhL0JAERGosa1adogXgqjDml4Pm/?auction_id=92702ce1-2328-4c7a-57aa-41c738e8bb75',
112
  'mediaType': 'video',
113
  'meta': {
114
    'advertiserDomains': [
115
      'buzzoola.com'
116
    ]
117
  }
118
}];
119

120
const RENDERER_DATA = {
1✔
121
  data: JSON.parse(VIDEO_RESPONSE[0].ad)
122
};
123
RENDERER_DATA.data.placement.unit_settings.width = '' + VIDEO_RESPONSE[0].width;
1✔
124
RENDERER_DATA.data.placement.unit_settings.height = RENDERER_DATA.data.placement.unit_settings.container_height = '' + VIDEO_RESPONSE[0].height;
1✔
125

126
const REQUIRED_VIDEO_FIELDS = [
1✔
127
  'requestId',
128
  'cpm',
129
  'width',
130
  'height',
131
  'ad',
132
  'ttl',
133
  'creativeId',
134
  'netRevenue',
135
  'currency',
136
  'vastUrl',
137
  'mediaType',
138
  'meta'
139
];
140

141
const NATIVE_BID = {
1✔
142
  'bidder': 'buzzoola',
143
  'params': {'placementId': 417845},
144
  'mediaTypes': {
145
    'native': {
146
      'image': {
147
        'required': true,
148
        'sizes': [640, 134]
149
      },
150
      'title': {
151
        'required': true,
152
        'len': 80
153
      },
154
      'sponsoredBy': {
155
        'required': true
156
      },
157
      'clickUrl': {
158
        'required': true
159
      },
160
      'privacyLink': {
161
        'required': false
162
      },
163
      'body': {
164
        'required': true
165
      },
166
      'icon': {
167
        'required': true,
168
        'sizes': [50, 50]
169
      }
170
    }
171
  },
172
  'bidId': '22a42cd3522c6f'
173
};
174

175
const NATIVE_BID_REQUEST = {
1✔
176
  bidderCode: 'buzzoola',
177
  bids: [NATIVE_BID]
178
};
179

180
const NATIVE_RESPONSE = [{
1✔
181
  'requestId': '22a42cd3522c6f',
182
  'cpm': 6.553015238095238,
183
  'width': 600,
184
  'height': 300,
185
  'creativeId': '17970',
186
  'dealId': '',
187
  'currency': 'RUB',
188
  'netRevenue': true,
189
  'ttl': 10800,
190
  'ad': 'https://tube.buzzoola.com/xstatic/o42/stoloto/6',
191
  'mediaType': 'native',
192
  'native': {
193
    'body': 'В 1388-м тираже «Русского лото» джекпот',
194
    'clickTrackers': [
195
      'https://exchange.buzzoola.com/event/6cee890f-1878-4a37-46b3-0107b6c590ae/a1aedc5b-50f2-4a7c-6d24-e235bb1f87ed/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpJwP8cy-zNH8GX-_nWFkILh/click/'
196
    ],
197
    'clickUrl': 'https://ad.doubleclick.net/ddm/trackclk/N250204.3446512BUZZOOLA/B25801892.303578321;dc_trk_aid=496248119;dc_trk_cid=151207455;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;ltd=?https://stoloto.onelink.me/mEJM?pid=Buzzoola_mb4&c=rl_10_05_2021&is_retargeting=true&af_ios_url=https%3A%2F%2Fapps.apple.com%2Fru%2Fapp%2F%25D1%2581%25D1%2582%25D0%25BE%25D0%25BB%25D0%25BE%25D1%2582%25D0%25BE-%25D1%2583-%25D0%25BD%25D0%25B0%25D1%2581-%25D0%25B2%25D1%258B%25D0%25B8%25D0%25B3%25D1%2580%25D1%258B%25D0%25B2%25D0%25B0%25D1%258E%25D1%2582%2Fid579961527&af_android_url=https%3A%2F%2Fgalaxystore.samsung.com%2Fdetail%2Fru.stoloto.mobile&af_dp=stolotoone%3A%2F%2Fgames&af_web_dp=https%3A%2F%2Fwww.stoloto.ru%2Fruslotto%2Fgame%3Flastdraw%3Fad%3Dbuzzoola_app_dx_rl_10_05_2021%26utm_source%3Dbuzzoola_app_dx%26utm_medium%3Dcpm%26utm_campaign%3Drl_10_05_2021%26utm_content%3Dbuzzoola_app_dx_mob_native_ios_mb4%26utm_term%3D__6ple2-9znjyg_',
198
    'icon': {
199
      'height': '100',
200
      'url': 'https://tube.buzzoola.com/xstatic/o42/stoloto/logo3.png',
201
      'width': '100'
202
    },
203
    'image': {
204
      'height': '450',
205
      'url': 'https://tube.buzzoola.com/xstatic/o42/stoloto/6/16x9.png',
206
      'width': '800'
207
    },
208
    'impressionTrackers': [
209
      'https://exchange.buzzoola.com/event/6cee890f-1878-4a37-46b3-0107b6c590ae/a1aedc5b-50f2-4a7c-6d24-e235bb1f87ed/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpJwP8cy-zNH8GX-_nWFkILh/ctor/',
210
      'https://exchange.buzzoola.com/event/6cee890f-1878-4a37-46b3-0107b6c590ae/a1aedc5b-50f2-4a7c-6d24-e235bb1f87ed/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpJwP8cy-zNH8GX-_nWFkILh/impression/?price=${AUCTION_PRICE}&cur=${AUCTION_CURRENCY}',
211
      'https://exchange.buzzoola.com/event/6cee890f-1878-4a37-46b3-0107b6c590ae/a1aedc5b-50f2-4a7c-6d24-e235bb1f87ed/m7JVQI9Y7J35_gEDugNO2bIiP2qTqPKfuLrqqh_LoJu0tD6PoLEglMXUBzVpSg75c-unsaijXpJwP8cy-zNH8GX-_nWFkILh/player_seen/',
212
      'https://cr.frontend.weborama.fr/cr?key=mailru&url=https%3A%2F%2Fad.mail.ru%2Fcm.gif%3Fp%3D68%26id%3D%7BWEBO_CID%7D'
213
    ],
214
    'sponsoredBy': 'Buzzoola',
215
    'title': 'Test PrebidJS Native'
216
  },
217
  'meta': {
218
    'advertiserDomains': [
219
      'buzzoola.com'
220
    ]
221
  }
222
}];
223

224
const REQUIRED_NATIVE_FIELDS = [
1✔
225
  'requestId',
226
  'cpm',
227
  'width',
228
  'height',
229
  'ad',
230
  'native',
231
  'ttl',
232
  'creativeId',
233
  'netRevenue',
234
  'currency',
235
  'mediaType',
236
  'meta'
237
];
238

239
describe('buzzoolaBidAdapter', () => {
1✔
240
  const adapter = newBidder(spec);
1✔
241

242
  describe('inherited functions', () => {
1✔
243
    it('exists and is a function', () => {
1✔
244
      expect(adapter.callBids).to.exist.and.to.be.a('function');
1✔
245
    });
246
  });
247

248
  describe('isBidRequestValid', () => {
1✔
249
    it('should return true when required params found', () => {
1✔
250
      expect(spec.isBidRequestValid(VIDEO_BID)).to.be.true;
1✔
251
    });
252

253
    it('should return false when required params are not passed', () => {
1✔
254
      INVALID_BIDS.forEach(bid => {
1✔
255
        expect(spec.isBidRequestValid(bid)).to.be.false;
4✔
256
      });
257
    });
258
  });
259

260
  describe('buildRequests', () => {
1✔
261
    const videoBidRequests = [VIDEO_BID];
1✔
262
    const bannerBidRequests = [BANNER_BID];
1✔
263
    const nativeBidRequests = [NATIVE_BID];
1✔
264

265
    const bannerRequest = spec.buildRequests(bannerBidRequests, BANNER_BID_REQUEST);
1✔
266
    const nativeRequest = spec.buildRequests(nativeBidRequests, NATIVE_BID_REQUEST);
1✔
267
    const videoRequest = spec.buildRequests(videoBidRequests, VIDEO_BID_REQUEST);
1✔
268

269
    it('sends bid request to ENDPOINT via POST', () => {
1✔
270
      expect(videoRequest.method).to.equal('POST');
1✔
271
      expect(bannerRequest.method).to.equal('POST');
1✔
272
      expect(nativeRequest.method).to.equal('POST');
1✔
273
    });
274

275
    it('sends bid request to correct ENDPOINT', () => {
1✔
276
      expect(videoRequest.url).to.equal(ENDPOINT);
1✔
277
      expect(bannerRequest.url).to.equal(ENDPOINT);
1✔
278
      expect(nativeRequest.url).to.equal(ENDPOINT);
1✔
279
    });
280

281
    it('sends correct video bid parameters', () => {
1✔
282
      expect(videoRequest.data).to.deep.equal(VIDEO_BID_REQUEST);
1✔
283
    });
284

285
    it('sends correct banner bid parameters', () => {
1✔
286
      expect(bannerRequest.data).to.deep.equal(BANNER_BID_REQUEST);
1✔
287
    });
288

289
    it('sends correct native bid parameters', () => {
1✔
290
      expect(nativeRequest.data).to.deep.equal(NATIVE_BID_REQUEST);
1✔
291
    });
292
  });
293

294
  describe('interpretResponse', () => {
1✔
295
    const noBidServerResponse = [];
1✔
296
    const emptyResponse = '';
1✔
297

298
    function nobidServerResponseCheck(request, response = noBidServerResponse) {
6✔
299
      const noBidResult = spec.interpretResponse({body: response}, {data: request});
6✔
300

301
      expect(noBidResult.length).to.equal(0);
6✔
302
    }
303

304
    function bidServerResponseCheck(response, request, fields) {
305
      const result = spec.interpretResponse({body: response}, {data: request});
3✔
306

307
      expect(result).to.deep.equal(response);
3✔
308
      result.forEach(bid => {
3✔
309
        fields.forEach(field => {
3✔
310
          expect(bid).to.have.own.property(field);
35✔
311
        })
312
      });
313
    }
314

315
    it('handles video nobid responses', () => {
1✔
316
      nobidServerResponseCheck(VIDEO_BID_REQUEST);
1✔
317
    });
318

319
    it('handles banner nobid responses', () => {
1✔
320
      nobidServerResponseCheck(BANNER_BID_REQUEST);
1✔
321
    });
322

323
    it('handles native nobid responses', () => {
1✔
324
      nobidServerResponseCheck(NATIVE_BID_REQUEST);
1✔
325
    });
326

327
    it('handles video empty responses', () => {
1✔
328
      nobidServerResponseCheck(VIDEO_BID_REQUEST, emptyResponse);
1✔
329
    });
330

331
    it('handles banner empty responses', () => {
1✔
332
      nobidServerResponseCheck(BANNER_BID_REQUEST, emptyResponse);
1✔
333
    });
334

335
    it('handles native empty responses', () => {
1✔
336
      nobidServerResponseCheck(NATIVE_BID_REQUEST, emptyResponse);
1✔
337
    });
338

339
    it('should get correct video bid response', () => {
1✔
340
      bidServerResponseCheck(VIDEO_RESPONSE, VIDEO_BID_REQUEST, REQUIRED_VIDEO_FIELDS);
1✔
341
    });
342

343
    it('should get correct banner bid response', () => {
1✔
344
      bidServerResponseCheck(BANNER_RESPONSE, BANNER_BID_REQUEST, REQUIRED_BANNER_FIELDS);
1✔
345
    });
346

347
    it('should get correct native bid response', () => {
1✔
348
      bidServerResponseCheck(NATIVE_RESPONSE, NATIVE_BID_REQUEST, REQUIRED_NATIVE_FIELDS);
1✔
349
    });
350
  });
351

352
  describe('outstream renderer', () => {
1✔
353
    let result;
354
    let renderer;
355

356
    before(() => {
1✔
357
      const adContainer = document.createElement('div');
1✔
358
      adContainer.id = 'adUnitCode';
1✔
359
      document.body.appendChild(adContainer);
1✔
360

361
      const outstreamVideoBid = deepClone(VIDEO_BID);
1✔
362
      outstreamVideoBid.mediaTypes.video.context = 'outstream';
1✔
363

364
      const outstreamVideoRequest = deepClone(VIDEO_BID_REQUEST);
1✔
365
      outstreamVideoRequest.bids = [outstreamVideoBid];
1✔
366

367
      const scriptElement = document.createElement('div');
1✔
368

369
      const scriptStub = sinon.stub(document, 'createElement');
1✔
370
      scriptStub.withArgs('script').returns(scriptElement);
1✔
371

372
      result = spec.interpretResponse({body: VIDEO_RESPONSE}, {data: outstreamVideoRequest})[0];
1✔
373
      renderer = result.renderer;
1✔
374

375
      result.adUnitCode = 'adUnitCode';
1✔
376

377
      if (scriptElement.onload) {
1!
UNCOV
378
        scriptElement.onload();
×
379
      }
380

381
      scriptStub.restore();
1✔
382
    });
383

384
    it('should add renderer for outstream video', () => {
1✔
385
      expect(result).to.have.own.property('renderer');
1✔
386
    });
387

388
    it('should be instance of Renderer', () => {
1✔
389
      expect(renderer).to.be.instanceof(Renderer);
1✔
390
    });
391

392
    it('should have valid src', () => {
1✔
393
      expect(renderer.url).to.equal(RENDERER_SRC);
1✔
394
    });
395

396
    it('should create player instance', () => {
1✔
397
      window.Buzzoola = {
1✔
398
        Core: {
399
          install: () => {}
400
        }
401
      };
402
      const spy = sinon.spy(window.Buzzoola.Core, 'install');
1✔
403
      executeRenderer(renderer, result);
1✔
404
      renderer.callback();
1✔
405
      expect(spy.called).to.be.true;
1✔
406

407
      const spyCall = spy.getCall(0);
1✔
408

409
      expect(spyCall.args[0]).to.be.instanceof(Element);
1✔
410
      expect(spyCall.args[1]).to.deep.equal(RENDERER_DATA);
1✔
411
    });
412
  });
413
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc