UNPKG

mk9-prebid

Version:

Header Bidding Management Library

1,190 lines (1,130 loc) 156 kB
import {expect} from 'chai'; import {spec} from 'modules/pubmaticBidAdapter.js'; import * as utils from 'src/utils.js'; import {config} from 'src/config.js'; import { createEidsArray } from 'modules/userId/eids.js'; const constants = require('src/constants.json'); describe('PubMatic adapter', function () { let bidRequests; let videoBidRequests; let multipleMediaRequests; let bidResponses; let nativeBidRequests; let nativeBidRequestsWithAllParams; let nativeBidRequestsWithoutAsset; let nativeBidRequestsWithRequiredParam; let nativeBidResponse; let validnativeBidImpression; let validnativeBidImpressionWithRequiredParam; let nativeBidImpressionWithoutRequiredParams; let validnativeBidImpressionWithAllParams; let bannerAndVideoBidRequests; let bannerAndNativeBidRequests; let videoAndNativeBidRequests; let bannerVideoAndNativeBidRequests; let bannerBidResponse; let videoBidResponse; let schainConfig; let outstreamBidRequest; let validOutstreamBidRequest; let outstreamVideoBidResponse; beforeEach(function () { schainConfig = { 'ver': '1.0', 'complete': 1, 'nodes': [ { 'asi': 'indirectseller.com', 'sid': '00001', 'hp': 1 }, { 'asi': 'indirectseller-2.com', 'sid': '00002', 'hp': 2 } ] }; bidRequests = [ { bidder: 'pubmatic', mediaTypes: { banner: { sizes: [[728, 90], [160, 600]] } }, params: { publisherId: '5670', adSlot: '/15671365/DMDemo@300x250:0', kadfloor: '1.2', pmzoneid: 'aabc, ddef', kadpageurl: 'www.publisher.com', yob: '1986', gender: 'M', lat: '12.3', lon: '23.7', wiid: '1234567890', profId: '100', verId: '200', currency: 'AUD', dctr: 'key1:val1,val2|key2:val1' }, placementCode: '/19968336/header-bid-tag-1', sizes: [[300, 250], [300, 600]], bidId: '23acc48ad47af5', requestId: '0fb4905b-9456-4152-86be-c6f6d259ba99', bidderRequestId: '1c56ad30b9b8ca8', transactionId: '92489f71-1bf2-49a0-adf9-000cea934729', schain: schainConfig } ]; videoBidRequests = [ { code: 'video1', mediaTypes: { video: { playerSize: [640, 480], context: 'instream' } }, bidder: 'pubmatic', bidId: '22bddb28db77d', params: { publisherId: '5890', adSlot: 'Div1@0x0', // ad_id or tagid video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30, startdelay: 5, playbackmethod: [1, 3], api: [1, 2], protocols: [2, 3], battr: [13, 14], linearity: 1, placement: 2, minbitrate: 10, maxbitrate: 10 } } } ]; multipleMediaRequests = [ { bidder: 'pubmatic', params: { publisherId: '301', adSlot: '/15671365/DMDemo@300x250:0', kadfloor: '1.2', pmzoneid: 'aabc, ddef', kadpageurl: 'www.publisher.com', yob: '1986', gender: 'M', lat: '12.3', lon: '23.7', wiid: '1234567890', profId: '100', verId: '200' } }, { code: 'div-instream', mediaTypes: { video: { context: 'instream', playerSize: [300, 250] }, }, bidder: 'pubmatic', params: { publisherId: '5890', adSlot: 'Div1@640x480', // ad_id or tagid video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30, startdelay: 15, playbackmethod: [1, 3], api: [1, 2], protocols: [2, 3], w: 640, h: 480, battr: [13, 14], linearity: 1, placement: 2, minbitrate: 100, maxbitrate: 4096 } } } ]; nativeBidRequests = [{ code: '/19968336/prebid_native_example_1', sizes: [ [300, 250] ], mediaTypes: { native: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } } }, nativeParams: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, bidder: 'pubmatic', params: { publisherId: '5670', adSlot: '/43743431/NativeAutomationPrebid@1x1', }, bidId: '2a5571261281d4', requestId: 'B68287E1-DC39-4B38-9790-FE4F179739D6', bidderRequestId: '1c56ad30b9b8ca8', }]; nativeBidRequestsWithAllParams = [{ code: '/19968336/prebid_native_example_1', sizes: [ [300, 250] ], mediaTypes: { native: { title: {required: true, len: 80, ext: {'title1': 'title2'}}, icon: {required: true, sizes: [50, 50], ext: {'icon1': 'icon2'}}, image: {required: true, sizes: [728, 90], ext: {'image1': 'image2'}, 'mimes': ['image/png', 'image/gif']}, sponsoredBy: {required: true, len: 10, ext: {'sponsor1': 'sponsor2'}}, body: {required: true, len: 10, ext: {'body1': 'body2'}}, rating: {required: true, len: 10, ext: {'rating1': 'rating2'}}, likes: {required: true, len: 10, ext: {'likes1': 'likes2'}}, downloads: {required: true, len: 10, ext: {'downloads1': 'downloads2'}}, price: {required: true, len: 10, ext: {'price1': 'price2'}}, saleprice: {required: true, len: 10, ext: {'saleprice1': 'saleprice2'}}, phone: {required: true, len: 10, ext: {'phone1': 'phone2'}}, address: {required: true, len: 10, ext: {'address1': 'address2'}}, desc2: {required: true, len: 10, ext: {'desc21': 'desc22'}}, displayurl: {required: true, len: 10, ext: {'displayurl1': 'displayurl2'}} } }, nativeParams: { title: {required: true, len: 80, ext: {'title1': 'title2'}}, icon: {required: true, sizes: [50, 50], ext: {'icon1': 'icon2'}}, image: {required: true, sizes: [728, 90], ext: {'image1': 'image2'}, 'mimes': ['image/png', 'image/gif']}, sponsoredBy: {required: true, len: 10, ext: {'sponsor1': 'sponsor2'}}, body: {required: true, len: 10, ext: {'body1': 'body2'}}, rating: {required: true, len: 10, ext: {'rating1': 'rating2'}}, likes: {required: true, len: 10, ext: {'likes1': 'likes2'}}, downloads: {required: true, len: 10, ext: {'downloads1': 'downloads2'}}, price: {required: true, len: 10, ext: {'price1': 'price2'}}, saleprice: {required: true, len: 10, ext: {'saleprice1': 'saleprice2'}}, phone: {required: true, len: 10, ext: {'phone1': 'phone2'}}, address: {required: true, len: 10, ext: {'address1': 'address2'}}, desc2: {required: true, len: 10, ext: {'desc21': 'desc22'}}, displayurl: {required: true, len: 10, ext: {'displayurl1': 'displayurl2'}} }, bidder: 'pubmatic', params: { publisherId: '5670', adSlot: '/43743431/NativeAutomationPrebid@1x1', }, bidId: '2a5571261281d4', requestId: 'B68287E1-DC39-4B38-9790-FE4F179739D6', bidderRequestId: '1c56ad30b9b8ca8', }]; nativeBidRequestsWithoutAsset = [{ code: '/19968336/prebid_native_example_1', sizes: [ [300, 250] ], mediaTypes: { native: { type: 'image' } }, nativeParams: { title: { required: true }, image: { required: true }, sponsoredBy: { required: true }, clickUrl: { required: true } }, bidder: 'pubmatic', params: { publisherId: '5670', adSlot: '/43743431/NativeAutomationPrebid@1x1', } }]; nativeBidRequestsWithRequiredParam = [{ code: '/19968336/prebid_native_example_1', sizes: [ [300, 250] ], mediaTypes: { native: { title: { required: false, length: 80 }, image: { required: false, sizes: [300, 250] }, sponsoredBy: { required: true } } }, nativeParams: { title: { required: false, length: 80 }, image: { required: false, sizes: [300, 250] }, sponsoredBy: { required: true } }, bidder: 'pubmatic', params: { publisherId: '5670', adSlot: '/43743431/NativeAutomationPrebid@1x1', } }]; bannerAndVideoBidRequests = [ { code: 'div-banner-video', mediaTypes: { video: { playerSize: [640, 480], context: 'instream' }, banner: { sizes: [[300, 250], [300, 600]] } }, bidder: 'pubmatic', params: { publisherId: '301', adSlot: '/15671365/DMDemo@300x250:0', kadfloor: '1.2', pmzoneid: 'aabc, ddef', kadpageurl: 'www.publisher.com', yob: '1986', gender: 'M', lat: '12.3', lon: '23.7', wiid: '1234567890', profId: '100', verId: '200', currency: 'AUD', dctr: 'key1:val1,val2|key2:val1', video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30, startdelay: 15, playbackmethod: [1, 3], api: [1, 2], protocols: [2, 3], w: 640, h: 480, battr: [13, 14], linearity: 1, placement: 2, minbitrate: 100, maxbitrate: 4096 } }, placementCode: '/19968336/header-bid-tag-1', sizes: [[728, 90]], bidId: '23acc48ad47af5', requestId: '0fb4905b-9456-4152-86be-c6f6d259ba99', bidderRequestId: '1c56ad30b9b8ca8', transactionId: '92489f71-1bf2-49a0-adf9-000cea934729' } ]; bannerAndNativeBidRequests = [ { code: 'div-banner-native', mediaTypes: { native: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, banner: { sizes: [[300, 250], [300, 600]] } }, nativeParams: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, bidder: 'pubmatic', params: { publisherId: '301', adSlot: '/15671365/DMDemo@300x250:0', kadfloor: '1.2', pmzoneid: 'aabc, ddef', kadpageurl: 'www.publisher.com', yob: '1986', gender: 'M', lat: '12.3', lon: '23.7', wiid: '1234567890', profId: '100', verId: '200', currency: 'AUD', dctr: 'key1:val1,val2|key2:val1' }, placementCode: '/19968336/header-bid-tag-1', sizes: [[728, 90]], bidId: '23acc48ad47af5', requestId: '0fb4905b-9456-4152-86be-c6f6d259ba99', bidderRequestId: '1c56ad30b9b8ca8', transactionId: '92489f71-1bf2-49a0-adf9-000cea934729' } ]; videoAndNativeBidRequests = [ { code: 'div-video-native', mediaTypes: { native: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, video: { playerSize: [640, 480], context: 'instream' } }, nativeParams: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, bidder: 'pubmatic', params: { publisherId: '301', adSlot: '/15671365/DMDemo@300x250:0', video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30, startdelay: 15, playbackmethod: [1, 3], api: [1, 2], protocols: [2, 3], w: 640, h: 480, battr: [13, 14], linearity: 1, placement: 2, minbitrate: 100, maxbitrate: 4096 } }, placementCode: '/19968336/header-bid-tag-1', sizes: [[728, 90]], bidId: '23acc48ad47af5', requestId: '0fb4905b-9456-4152-86be-c6f6d259ba99', bidderRequestId: '1c56ad30b9b8ca8', transactionId: '92489f71-1bf2-49a0-adf9-000cea934729' } ]; bannerVideoAndNativeBidRequests = [ { code: 'div-video-native', mediaTypes: { native: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, video: { playerSize: [640, 480], context: 'instream' }, banner: { sizes: [[300, 250], [300, 600]] } }, nativeParams: { title: { required: true, length: 80 }, image: { required: true, sizes: [300, 250] }, sponsoredBy: { required: true } }, bidder: 'pubmatic', params: { publisherId: '301', adSlot: '/15671365/DMDemo@300x250:0', video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30, startdelay: 15, playbackmethod: [1, 3], api: [1, 2], protocols: [2, 3], w: 640, h: 480, battr: [13, 14], linearity: 1, placement: 2, minbitrate: 100, maxbitrate: 4096 } }, placementCode: '/19968336/header-bid-tag-1', sizes: [[728, 90]], bidId: '23acc48ad47af5', requestId: '0fb4905b-9456-4152-86be-c6f6d259ba99', bidderRequestId: '1c56ad30b9b8ca8', transactionId: '92489f71-1bf2-49a0-adf9-000cea934729' } ]; bidResponses = { 'body': { 'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865', 'seatbid': [{ 'seat': 'seat-id', 'ext': { 'buyid': 'BUYER-ID-987' }, 'bid': [{ 'id': '74858439-49D7-4169-BA5D-44A046315B2F', 'impid': '22bddb28db77d', 'price': 1.3, 'adm': 'image3.pubmatic.com Layer based creative', 'adomain': ['blackrock.com'], 'h': 250, 'w': 300, 'ext': { 'deal_channel': 6, 'advid': 976, 'dspid': 123 } }] }, { 'ext': { 'buyid': 'BUYER-ID-789' }, 'bid': [{ 'id': '74858439-49D7-4169-BA5D-44A046315BEF', 'impid': '22bddb28db77e', 'price': 1.7, 'adm': 'image3.pubmatic.com Layer based creative', 'adomain': ['hivehome.com'], 'h': 250, 'w': 300, 'ext': { 'deal_channel': 5, 'advid': 832, 'dspid': 422 } }] }] } }; nativeBidResponse = { 'body': { 'id': '1544691825939', 'seatbid': [{ 'bid': [{ 'id': 'B68287E1-DC39-4B38-9790-FE4F179739D6', 'impid': '2a5571261281d4', 'price': 0.01, 'adm': "{\"native\":{\"assets\":[{\"id\":1,\"title\":{\"text\":\"Native Test Title\"}},{\"id\":2,\"img\":{\"h\":627,\"url\":\"http://stagingpub.net/native_ads/PM-Native-Ad-1200x627.png\",\"w\":1200}},{\"data\":{\"value\":\"Sponsored By PubMatic\"},\"id\":4}],\"imptrackers\":[\"http://imptracker.com/main/9bde02d0-6017-11e4-9df7-005056967c35\",\"http://172.16.4.213/AdServer/AdDisplayTrackerServlet?operId=1&pubId=5890&siteId=5892&adId=6016&adType=12&adServerId=243&kefact=0.010000&kaxefact=0.010000&kadNetFrequecy=0&kadwidth=0&kadheight=0&kadsizeid=7&kltstamp=1544692761&indirectAdId=0&adServerOptimizerId=2&ranreq=0.1&kpbmtpfact=1.000000&dcId=1&tldId=0&passback=0&svr=MADS1107&ekefact=GSQSXOLKDgBAvRnoiNj0LxtpAnNEO30u1ZI5sITloOsP7gzh&ekaxefact=GSQSXAXLDgD0fOZLCjgbnVJiyS3D65dqDkxfs2ArpC3iugXw&ekpbmtpfact=GSQSXCDLDgB5mcooOvXtCKmx7TnNDJDY2YuHFOL3o9ceoU4H&crID=campaign111&lpu=advertiserdomain.com&ucrid=273354366805642829&campaignId=16981&creativeId=0&pctr=0.000000&wDSPByrId=511&wDspId=6&wbId=0&wrId=0&wAdvID=1&isRTB=1&rtbId=C09BB577-B8C1-4C3E-A0FF-73F6F631C80A&imprId=B68287E1-DC39-4B38-9790-FE4F179739D6&oid=B68287E1-DC39-4B38-9790-FE4F179739D6&pageURL=http%3A%2F%2Ftest.com%2FTestPages%2Fnativead.html\"],\"jstracker\":\"<script src='http:\\\\/\\\\/stagingpub.net\\\\/native\\\\/tempReseponse.js'><script src='http:\\\\/\\\\/stagingpub.net\\\\/native\\\\/tempReseponse.js'>\",\"link\":{\"clicktrackers\":[\"http://clicktracker.com/main/9bde02d0-6017-11e4-9df7-005056967c35\",\"&pubId=5890&siteId=5892&adId=6016&kadsizeid=7&tldId=0&passback=0&campaignId=16981&creativeId=0&adServerId=243&impid=B68287E1-DC39-4B38-9790-FE4F179739D6\"],\"fallback\":\"http://www.pubmatic.com\",\"url\":\"http://www.pubmatic.com\"}}}", 'adomain': ['advertiserdomain.com'], 'cid': '16981', 'crid': 'campaign111', 'ext': { 'dspid': 6 } }], 'seat': '527' }], 'cur': 'USD' } } validnativeBidImpression = { 'native': { 'request': '{"assets":[{"id":1,"required":1,"title":{"len":80}},{"id":2,"required":1,"img":{"type":3,"w":300,"h":250}},{"id":4,"required":1,"data":{"type":1}}]}' } } nativeBidImpressionWithoutRequiredParams = { 'native': { 'request': '{"assets":[{"id":4,"required":1,"data":{"type":1}}]}' } } validnativeBidImpressionWithRequiredParam = { 'native': { 'request': '{"assets":[{"id":1,"required":0,"title":{"len":80}},{"id":2,"required":0,"img":{"type":3,"w":300,"h":250}},{"id":4,"required":1,"data":{"type":1}}]}' } } validnativeBidImpressionWithAllParams = { native: { 'request': '{"assets":[{"id":1,"required":1,"title":{"len":80,"ext":{"title1":"title2"}}},{"id":3,"required":1,"img":{"type":1,"w":50,"h":50}},{"id":2,"required":1,"img":{"type":3,"w":728,"h":90,"mimes":["image/png","image/gif"],"ext":{"image1":"image2"}}},{"id":4,"required":1,"data":{"type":1,"len":10,"ext":{"sponsor1":"sponsor2"}}},{"id":5,"required":1,"data":{"type":2,"len":10,"ext":{"body1":"body2"}}},{"id":13,"required":1,"data":{"type":3,"len":10,"ext":{"rating1":"rating2"}}},{"id":14,"required":1,"data":{"type":4,"len":10,"ext":{"likes1":"likes2"}}},{"id":15,"required":1,"data":{"type":5,"len":10,"ext":{"downloads1":"downloads2"}}},{"id":16,"required":1,"data":{"type":6,"len":10,"ext":{"price1":"price2"}}},{"id":17,"required":1,"data":{"type":7,"len":10,"ext":{"saleprice1":"saleprice2"}}},{"id":18,"required":1,"data":{"type":8,"len":10,"ext":{"phone1":"phone2"}}},{"id":19,"required":1,"data":{"type":9,"len":10,"ext":{"address1":"address2"}}},{"id":20,"required":1,"data":{"type":10,"len":10,"ext":{"desc21":"desc22"}}},{"id":21,"required":1,"data":{"type":11,"len":10,"ext":{"displayurl1":"displayurl2"}}}]}' } } bannerBidResponse = { 'body': { 'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865', 'seatbid': [{ 'bid': [{ 'id': '74858439-49D7-4169-BA5D-44A046315B2F', 'impid': '23acc48ad47af5', 'price': 1.3, 'adm': '<span class="PubAPIAd" id="4E733404-CC2E-48A2-BC83-4DD5F38FE9BB"><script type="text/javascript"> document.writeln(\'<iframe width="300" scrolling="no" height="250" frameborder="0" name="iframe0" allowtransparency="true" marginheight="0" marginwidth="0" vspace="0" hspace="0" src="http://ads.pubmatic.com/AdTag/dummyImage.png"></iframe>\');</script><iframe width="0" scrolling="no" height="0" frameborder="0" src="http://aktrack.pubmatic.com/AdServer/AdDisplayTrackerServlet?pubId=5890" style="position:absolute;top:-15000px;left:-15000px" vspace="0" hspace="0" marginwidth="0" marginheight="0" allowtransparency="true" name="pbeacon"></iframe></span> <!-- PubMatic Ad Ends -->', 'h': 250, 'w': 300, 'ext': { 'deal_channel': 6 } }] }] } }; videoBidResponse = { 'body': { 'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865', 'seatbid': [{ 'bid': [{ 'id': '74858439-49D7-4169-BA5D-44A046315B2F', 'impid': '22bddb28db77d', 'price': 1.3, 'adm': '<VAST version="3.0"><Ad id="601364"><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Impression><![CDATA[http://172.16.4.213/AdServer/AdDisplayTrackerServlet?operId=1&pubId=5890&siteId=47163&adId=1405268&adType=13&adServerId=243&kefact=70.000000&kaxefact=70.000000&kadNetFrequecy=0&kadwidth=0&kadheight=0&kadsizeid=97&kltstamp=1529929473&indirectAdId=0&adServerOptimizerId=2&ranreq=0.1&kpbmtpfact=100.000000&dcId=1&tldId=0&passback=0&svr=MADS1107&ekefact=Ad8wW91TCwCmdG0jlfjXn7Tyzh20hnTVx-m5DoNSep-RXGDr&ekaxefact=Ad8wWwRUCwAGir4Zzl1eF0bKiC-qrCV0D0yp_eE7YizB_BQk&ekpbmtpfact=Ad8wWxRUCwD7qgzwwPE2LnS5-Ou19uO5amJl1YT6-XVFvQ41&imprId=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&oid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&crID=creative-1_1_2&ucrid=160175026529250297&campaignId=17050&creativeId=0&pctr=0.000000&wDSPByrId=511&wDspId=6&wbId=0&wrId=0&wAdvID=3170&isRTB=1&rtbId=EBCA079F-8D7C-45B8-B733-92951F670AA1&pmZoneId=zone1&pageURL=www.yahoo.com&lpu=ae.com]]></Impression><Impression>https://dsptracker.com/{PSPM}</Impression><Error><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&er=[ERRORCODE]]]></Error><Error><![CDATA[https://Errortrack.com?p=1234&er=[ERRORCODE]]]></Error><Creatives><Creative AdID="601364"><Linear skipoffset="20%"><TrackingEvents><Tracking event="close"><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event="skip"><![CDATA[https://mytracking.com/linear/skip]]></Tracking><Tracking event="creativeView"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=1]]></Tracking><Tracking event="start"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=2]]></Tracking><Tracking event="midpoint"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=3]]></Tracking><Tracking event="firstQuartile"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=4]]></Tracking><Tracking event="thirdQuartile"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=5]]></Tracking><Tracking event="complete"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=6]]></Tracking></TrackingEvents><Duration>00:00:04</Duration><VideoClicks><ClickTracking><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=99]]></ClickTracking><ClickThrough>https://www.pubmatic.com</ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" type="video/mp4" bitrate="500" width="400" height="300" scalable="true" maintainAspectRatio="true"><![CDATA[https://stagingnyc.pubmatic.com:8443/video/Shashank/mediaFileHost/media/mp4-sample-2.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>', 'h': 250, 'w': 300, 'ext': { 'deal_channel': 6 } }] }] } }; outstreamBidRequest = [ { code: 'video1', mediaTypes: { video: { playerSize: [640, 480], context: 'outstream' } }, bidder: 'pubmatic', bidId: '47acc48ad47af5', requestId: '0fb4905b-1234-4152-86be-c6f6d259ba99', bidderRequestId: '1c56ad30b9b8ca8', transactionId: '92489f71-1bf2-49a0-adf9-000cea934729', params: { publisherId: '5670', outstreamAU: 'pubmatic-test', adSlot: 'Div1@0x0', // ad_id or tagid video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30 } } } ]; validOutstreamBidRequest = { auctionId: '92489f71-1bf2-49a0-adf9-000cea934729', auctionStart: 1585918458868, bidderCode: 'pubmatic', bidderRequestId: '47acc48ad47af5', bids: [{ adUnitCode: 'video1', auctionId: '92489f71-1bf2-49a0-adf9-000cea934729', bidId: '47acc48ad47af5', bidRequestsCount: 1, bidder: 'pubmatic', bidderRequestId: '47acc48ad47af5', mediaTypes: { video: { context: 'outstream' } }, params: { publisherId: '5670', outstreamAU: 'pubmatic-test', adSlot: 'Div1@0x0', // ad_id or tagid video: { mimes: ['video/mp4', 'video/x-flv'], skippable: true, minduration: 5, maxduration: 30 } }, sizes: [[768, 432], [640, 480], [630, 360]], transactionId: '92489f71-1bf2-49a0-adf9-000cea934729' }], start: 11585918458869, timeout: 3000 }; outstreamVideoBidResponse = { 'body': { 'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865', 'seatbid': [{ 'bid': [{ 'id': '0fb4905b-1234-4152-86be-c6f6d259ba99', 'impid': '47acc48ad47af5', 'price': 1.3, 'adm': '<VAST version="3.0"><Ad id="601364"><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Impression><![CDATA[http://172.16.4.213/AdServer/AdDisplayTrackerServlet?operId=1&pubId=5890&siteId=47163&adId=1405268&adType=13&adServerId=243&kefact=70.000000&kaxefact=70.000000&kadNetFrequecy=0&kadwidth=0&kadheight=0&kadsizeid=97&kltstamp=1529929473&indirectAdId=0&adServerOptimizerId=2&ranreq=0.1&kpbmtpfact=100.000000&dcId=1&tldId=0&passback=0&svr=MADS1107&ekefact=Ad8wW91TCwCmdG0jlfjXn7Tyzh20hnTVx-m5DoNSep-RXGDr&ekaxefact=Ad8wWwRUCwAGir4Zzl1eF0bKiC-qrCV0D0yp_eE7YizB_BQk&ekpbmtpfact=Ad8wWxRUCwD7qgzwwPE2LnS5-Ou19uO5amJl1YT6-XVFvQ41&imprId=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&oid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&crID=creative-1_1_2&ucrid=160175026529250297&campaignId=17050&creativeId=0&pctr=0.000000&wDSPByrId=511&wDspId=6&wbId=0&wrId=0&wAdvID=3170&isRTB=1&rtbId=EBCA079F-8D7C-45B8-B733-92951F670AA1&pmZoneId=zone1&pageURL=www.yahoo.com&lpu=ae.com]]></Impression><Impression>https://dsptracker.com/{PSPM}</Impression><Error><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&er=[ERRORCODE]]]></Error><Error><![CDATA[https://Errortrack.com?p=1234&er=[ERRORCODE]]]></Error><Creatives><Creative AdID="601364"><Linear skipoffset="20%"><TrackingEvents><Tracking event="close"><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event="skip"><![CDATA[https://mytracking.com/linear/skip]]></Tracking><Tracking event="creativeView"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=1]]></Tracking><Tracking event="start"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=2]]></Tracking><Tracking event="midpoint"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=3]]></Tracking><Tracking event="firstQuartile"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=4]]></Tracking><Tracking event="thirdQuartile"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=5]]></Tracking><Tracking event="complete"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=6]]></Tracking></TrackingEvents><Duration>00:00:04</Duration><VideoClicks><ClickTracking><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=99]]></ClickTracking><ClickThrough>https://www.pubmatic.com</ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" type="video/mp4" bitrate="500" width="400" height="300" scalable="true" maintainAspectRatio="true"><![CDATA[https://stagingnyc.pubmatic.com:8443/video/Shashank/mediaFileHost/media/mp4-sample-2.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>', 'h': 250, 'w': 300, 'ext': { 'deal_channel': 6 } }] }] } }; }); describe('implementation', function () { describe('Bid validations', function () { it('valid bid case', function () { let validBid = { bidder: 'pubmatic', params: { publisherId: '301', adSlot: '/15671365/DMDemo@300x250:0' } }, isValid = spec.isBidRequestValid(validBid); expect(isValid).to.equal(true); }); it('invalid bid case: publisherId not passed', function () { let validBid = { bidder: 'pubmatic', params: { adSlot: '/15671365/DMDemo@300x250:0' } }, isValid = spec.isBidRequestValid(validBid); expect(isValid).to.equal(false); }); it('invalid bid case: publisherId is not string', function () { let validBid = { bidder: 'pubmatic', params: { publisherId: 301, adSlot: '/15671365/DMDemo@300x250:0' } }, isValid = spec.isBidRequestValid(validBid); expect(isValid).to.equal(false); }); it('valid bid case: adSlot is not passed', function () { let validBid = { bidder: 'pubmatic', params: { publisherId: '301' } }, isValid = spec.isBidRequestValid(validBid); expect(isValid).to.equal(true); }); it('should check for context if video is present', function() { let bid = { 'bidder': 'pubmatic', 'params': { 'adSlot': 'SLOT_NHB1@728x90', 'publisherId': '5890' }, 'mediaTypes': { 'video': { 'playerSize': [ [640, 480] ], 'protocols': [1, 2, 5], 'context': 'instream', 'mimes': ['video/flv'], 'skippable': false, 'skip': 1, 'linearity': 2 } }, 'adUnitCode': 'video1', 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf', 'sizes': [ [640, 480] ], 'bidId': '2c95df014cfe97', 'bidderRequestId': '1fe59391566442', 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0 }, isValid = spec.isBidRequestValid(bid); expect(isValid).to.equal(true); }) it('should return false if context is not present in video', function() { let bid = { 'bidder': 'pubmatic', 'params': { 'adSlot': 'SLOT_NHB1@728x90', 'publisherId': '5890' }, 'mediaTypes': { 'video': { 'w': 640, 'h': 480, 'protocols': [1, 2, 5], 'mimes': ['video/flv'], 'skippable': false, 'skip': 1, 'linearity': 2 } }, 'adUnitCode': 'video1', 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf', 'sizes': [ [640, 480] ], 'bidId': '2c95df014cfe97', 'bidderRequestId': '1fe59391566442', 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0 }, isValid = spec.isBidRequestValid(bid); expect(isValid).to.equal(false); }) it('bid.mediaTypes.video.mimes OR bid.params.video.mimes should be present and must be a non-empty array', function() { let bid = { 'bidder': 'pubmatic', 'params': { 'adSlot': 'SLOT_NHB1@728x90', 'publisherId': '5890', 'video': {} }, 'mediaTypes': { 'video': { 'playerSize': [ [640, 480] ], 'protocols': [1, 2, 5], 'context': 'instream', 'skippable': false, 'skip': 1, 'linearity': 2 } }, 'adUnitCode': 'video1', 'transactionId': '803e3750-0bbe-4ffe-a548-b6eca15087bf', 'sizes': [ [640, 480] ], 'bidId': '2c95df014cfe97', 'bidderRequestId': '1fe59391566442', 'auctionId': '3a4118ef-fb96-4416-b0b0-3cfc1cebc142', 'src': 'client', 'bidRequestsCount': 1, 'bidderRequestsCount': 1, 'bidderWinsCount': 0 }; delete bid.params.video.mimes; // Undefined bid.mediaTypes.video.mimes = 'string'; // NOT array expect(spec.isBidRequestValid(bid)).to.equal(false); delete bid.params.video.mimes; // Undefined delete bid.mediaTypes.video.mimes; // Undefined expect(spec.isBidRequestValid(bid)).to.equal(false); delete bid.params.video.mimes; // Undefined bid.mediaTypes.video.mimes = ['video/flv']; // Valid expect(spec.isBidRequestValid(bid)).to.equal(true); delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined bid.params.video = {mimes: 'string'}; // NOT array expect(spec.isBidRequestValid(bid)).to.equal(false); delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined delete bid.params.video.mimes; // Undefined expect(spec.isBidRequestValid(bid)).to.equal(false); delete bid.mediaTypes.video.mimes; // mediaTypes.video.mimes undefined bid.params.video.mimes = ['video/flv']; // Valid expect(spec.isBidRequestValid(bid)).to.equal(true); delete bid.mediaTypes.video.mimes; // Undefined bid.params.video.mimes = ['video/flv']; // Valid expect(spec.isBidRequestValid(bid)).to.equal(true); delete bid.mediaTypes.video.mimes; // Undefined delete bid.params.video.mimes; // Undefined expect(spec.isBidRequestValid(bid)).to.equal(false); }); it('checks on bid.params.outstreamAU & bid.renderer & bid.mediaTypes.video.renderer', function() { const getThebid = function() { let bid = utils.deepClone(validOutstreamBidRequest.bids[0]); bid.params.outstreamAU = 'pubmatic-test'; bid.renderer = ' '; // we are only checking if this key is set or not bid.mediaTypes.video.renderer = ' '; // we are only checking if this key is set or not return bid; } // true: when all are present // mdiatype: outstream // bid.params.outstreamAU : Y // bid.renderer : Y // bid.mediaTypes.video.renderer : Y let bid = getThebid(); expect(spec.isBidRequestValid(bid)).to.equal(true); // true: atleast one is present; 3 cases // mdiatype: outstream // bid.params.outstreamAU : Y // bid.renderer : N // bid.mediaTypes.video.renderer : N bid = getThebid(); delete bid.renderer; delete bid.mediaTypes.video.renderer; expect(spec.isBidRequestValid(bid)).to.equal(true); // true: atleast one is present; 3 cases // mdiatype: outstream // bid.params.outstreamAU : N // bid.renderer : Y // bid.mediaTypes.video.renderer : N bid = getThebid(); delete bid.params.outstreamAU; delete bid.mediaTypes.video.renderer; expect(spec.isBidRequestValid(bid)).to.equal(true); // true: atleast one is present; 3 cases // mdiatype: outstream // bid.params.outstreamAU : N // bid.renderer : N // bid.mediaTypes.video.renderer : Y bid = getThebid(); delete bid.params.outstreamAU; delete bid.renderer; expect(spec.isBidRequestValid(bid)).to.equal(true); // false: none present; only outstream // mdiatype: outstream // bid.params.outstreamAU : N // bid.renderer : N // bid.mediaTypes.video.renderer : N bid = getThebid(); delete bid.params.outstreamAU; delete bid.renderer; delete bid.mediaTypes.video.renderer; expect(spec.isBidRequestValid(bid)).to.equal(false); // true: none present; outstream + Banner // mdiatype: outstream, banner // bid.params.outstreamAU : N // bid.renderer : N // bid.mediaTypes.video.renderer : N bid = getThebid(); delete bid.params.outstreamAU; delete bid.renderer; delete bid.mediaTypes.video.renderer; bid.mediaTypes.banner = {sizes: [ [300, 250], [300, 600] ]}; expect(spec.isBidRequestValid(bid)).to.equal(true); // true: none present; outstream + Native // mdiatype: outstream, native // bid.params.outstreamAU : N // bid.renderer : N // bid.mediaTypes.video.renderer : N bid = getThebid(); delete bid.params.outstreamAU; delete bid.renderer; delete bid.mediaTypes.video.renderer; bid.mediaTypes.native = {} expect(spec.isBidRequestValid(bid)).to.equal(true); }); }); describe('Request formation', function () { it('buildRequests function should not modify original bidRequests object', function () { let originalBidRequests = utils.deepClone(bidRequests); let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); expect(bidRequests).to.deep.equal(originalBidRequests); }); it('buildRequests function should not modify original nativebidRequests object', function () { let originalBidRequests = utils.deepClone(nativeBidRequests); let request = spec.buildRequests(nativeBidRequests, { auctionId: 'new-auction-id' }); expect(nativeBidRequests).to.deep.equal(originalBidRequests); }); it('Endpoint checking', function () { let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); expect(request.url).to.equal('https://hbopenbid.pubmatic.com/translator?source=prebid-client'); expect(request.method).to.equal('POST'); }); it('should return bidderRequest property', function() { let request = spec.buildRequests(bidRequests, validOutstreamBidRequest); expect(request.bidderRequest).to.equal(validOutstreamBidRequest); }); it('bidderRequest should be undefined if bidderRequest is not present', function() { let request = spec.buildRequests(bidRequests); expect(request.bidderRequest).to.be.undefined; }); it('test flag not sent when pubmaticTest=true is absent in page url', function() { let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.test).to.equal(undefined); }); // disabled this test case as it refreshes the whole suite when in karma watch mode // todo: needs a fix xit('test flag set to 1 when pubmaticTest=true is present in page url', function() { window.location.href += '#pubmaticTest=true'; // now all the test cases below will have window.location.href with #pubmaticTest=true let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.test).to.equal(1); }); it('Request params check', function () { let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.at).to.equal(1); // auction type expect(data.cur[0]).to.equal('USD'); // currency expect(data.site.domain).to.be.a('string'); // domain should be set expect(data.site.page).to.equal(bidRequests[0].params.kadpageurl); // forced pageURL expect(data.site.publisher.id).to.equal(bidRequests[0].params.publisherId); // publisher Id expect(data.user.yob).to.equal(parseInt(bidRequests[0].params.yob)); // YOB expect(data.user.gender).to.equal(bidRequests[0].params.gender); // Gender expect(data.device.geo.lat).to.equal(parseFloat(bidRequests[0].params.lat)); // Latitude expect(data.device.geo.lon).to.equal(parseFloat(bidRequests[0].params.lon)); // Lognitude expect(data.user.geo.lat).to.equal(parseFloat(bidRequests[0].params.lat)); // Latitude expect(data.user.geo.lon).to.equal(parseFloat(bidRequests[0].params.lon)); // Lognitude expect(data.ext.wrapper.wv).to.equal($$REPO_AND_VERSION$$); // Wrapper Version expect(data.ext.wrapper.transactionId).to.equal(bidRequests[0].transactionId); // Prebid TransactionId expect(data.source.tid).to.equal(bidRequests[0].transactionId); // Prebid TransactionId expect(data.ext.wrapper.wiid).to.equal(bidRequests[0].params.wiid); // OpenWrap: Wrapper Impression ID expect(data.ext.wrapper.profile).to.equal(parseInt(bidRequests[0].params.profId)); // OpenWrap: Wrapper Profile ID expect(data.ext.wrapper.version).to.equal(parseInt(bidRequests[0].params.verId)); // OpenWrap: Wrapper Profile Version ID expect(data.imp[0].id).to.equal(bidRequests[0].bidId); // Prebid bid id is passed as id expect(data.imp[0].bidfloor).to.equal(parseFloat(bidRequests[0].params.kadfloor)); // kadfloor expect(data.imp[0].tagid).to.equal('/15671365/DMDemo'); // tagid expect(data.imp[0].banner.w).to.equal(300); // width expect(data.imp[0].banner.h).to.equal(250); // height expect(data.imp[0].ext.pmZoneId).to.equal(bidRequests[0].params.pmzoneid.split(',').slice(0, 50).map(id => id.trim()).join()); // pmzoneid expect(data.imp[0].ext.key_val).to.exist.and.to.equal(bidRequests[0].params.dctr); expect(data.imp[0].bidfloorcur).to.equal(bidRequests[0].params.currency); expect(data.source.ext.schain).to.deep.equal(bidRequests[0].schain); }); it('Set content from config, set site.content', function() { let sandbox = sinon.sandbox.create(); const content = { 'id': 'alpha-numeric-id' }; sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { content: content }; return config[key]; }); let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.site.content).to.deep.equal(content); sandbox.restore(); }); it('Merge the device info from config', function() { let sandbox = sinon.sandbox.create(); sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { device: { 'newkey': 'new-device-data' } }; return config[key]; }); let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.device.js).to.equal(1); expect(data.device.dnt).to.equal((navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0); expect(data.device.h).to.equal(screen.height); expect(data.device.w).to.equal(screen.width); expect(data.device.language).to.equal(navigator.language); expect(data.device.newkey).to.equal('new-device-data');// additional data from config sandbox.restore(); }); it('Merge the device info from config; data from config overrides the info we have gathered', function() { let sandbox = sinon.sandbox.create(); sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { device: { newkey: 'new-device-data', language: 'MARATHI' } }; return config[key]; }); let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.device.js).to.equal(1); expect(data.device.dnt).to.equal((navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0); expect(data.device.h).to.equal(screen.height); expect(data.device.w).to.equal(screen.width); expect(data.device.language).to.equal('MARATHI');// // data overriding from config expect(data.device.newkey).to.equal('new-device-data');// additional data from config sandbox.restore(); }); it('Set app from config, copy publisher and ext from site, unset site', function() { let sandbox = sinon.sandbox.create(); sandbox.stub(config, 'getConfig').callsFake((key) => { var config = { app: { bundle: 'org.prebid.mobile.demoapp', domain: 'prebid.org' } }; return config[key]; }); let request = spec.buildRequests(bidRequests, { auctionId: 'new-auction-id' }); let data = JSON.parse(request.data); expect(data.app.bundle).to.equal('org.prebid.mobile.demoapp'); expect(data.app.domain).to.equal('prebid.org'); expect(data.app.publisher.id).to.equa