77describe ( 'Mobkoi bidding Adapter' , function ( ) {
88 const testAdServerBaseUrl = 'http://test.adServerBaseUrl.com' ;
99 const testRequestId = 'test-request-id' ;
10- const testPublisherId = 'mobkoiPublisherId' ;
1110 const testPlacementId = 'mobkoiPlacementId' ;
1211 const testBidId = 'test-bid-id' ;
1312 const bidderCode = 'mobkoi' ;
@@ -18,7 +17,6 @@ describe('Mobkoi bidding Adapter', function () {
1817 const getOrtb2 = ( ) => ( {
1918 site : {
2019 publisher : {
21- id : testPublisherId ,
2220 ext : { adServerBaseUrl : testAdServerBaseUrl }
2321 }
2422 }
@@ -34,7 +32,6 @@ describe('Mobkoi bidding Adapter', function () {
3432 auctionId : testAuctionId ,
3533 ortb2 : getOrtb2 ( ) ,
3634 params : {
37- publisherId : testPublisherId ,
3835 adServerBaseUrl : testAdServerBaseUrl ,
3936 placementId : testPlacementId
4037 }
@@ -102,36 +99,14 @@ describe('Mobkoi bidding Adapter', function () {
10299 bid = getBidderRequest ( ) . bids [ 0 ] ;
103100 } ) ;
104101
105- it ( 'should return true when publisher id only exists in ortb2' , function ( ) {
106- delete bid . params . publisherId ;
107- expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( true ) ;
108- } ) ;
109-
110102 it ( 'should return true when placement id exist in ad unit params' , function ( ) {
111103 expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( true ) ;
112104 } ) ;
113105
114- it ( 'should return true when publisher ID only exists in ad unit params' , function ( ) {
115- delete bid . ortb2 . site . publisher . id ;
116- expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( true ) ;
117- } ) ;
118-
119- it ( 'should return false when publisher id is missing both in ad unit params and ortb2' , function ( ) {
120- delete bid . ortb2 . site . publisher . id ;
121- delete bid . params . publisherId ;
122- expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false ) ;
123- } ) ;
124-
125106 it ( 'should return false when placement id is missing in ad unit params' , function ( ) {
126107 delete bid . params . placementId ;
127108 expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false ) ;
128109 } ) ;
129-
130- it ( 'should return false when publisher id is empty in ad unit params and ortb2' , function ( ) {
131- bid . ortb2 . site . publisher . id = '' ;
132- bid . params . publisherId = '' ;
133- expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false ) ;
134- } ) ;
135110 } ) ;
136111
137112 describe ( 'buildRequests' , function ( ) {
@@ -147,18 +122,9 @@ describe('Mobkoi bidding Adapter', function () {
147122 const ortbData = request . data ;
148123
149124 expect ( ortbData . id ) . to . equal ( bidderRequest . bidderRequestId ) ;
150- expect ( ortbData . site . publisher . id ) . to . equal ( bidderRequest . ortb2 . site . publisher . id ) ;
151125 } ) ;
152126
153- it ( 'should obtain publisher ID from ad unit params if the value does not exist in ortb2.' , function ( ) {
154- delete bidderRequest . ortb2 . site . publisher . id ;
155- const request = spec . buildRequests ( bidderRequest . bids , bidderRequest ) ;
156- const ortbData = request . data ;
157-
158- expect ( ortbData . site . publisher . id ) . to . equal ( bidderRequest . bids [ 0 ] . params . publisherId ) ;
159- } ) ;
160-
161- it ( 'should obtain adServerBaseUrl from ad unit params if the value does not exist in ortb2.' , function ( ) {
127+ it ( 'should obtain adServerBaseUrl from ad unit params if the value does not exist in ortb2' , function ( ) {
162128 delete bidderRequest . ortb2 . site . publisher . ext . adServerBaseUrl ;
163129 const request = spec . buildRequests ( bidderRequest . bids , bidderRequest ) ;
164130 const ortbData = request . data ;
@@ -226,20 +192,6 @@ describe('Mobkoi bidding Adapter', function () {
226192 } ) ;
227193 } )
228194
229- describe ( 'getPublisherId' , function ( ) {
230- it ( 'should return the publisherId from the given object' , function ( ) {
231- expect ( utils . getPublisherId ( bidderRequest ) ) . to . equal ( bidderRequest . ortb2 . site . publisher . id ) ;
232- } ) ;
233-
234- it ( 'should throw error when publisherId is missing' , function ( ) {
235- delete bidderRequest . ortb2 . site . publisher . id ;
236- delete bidderRequest . bids [ 0 ] . params . publisherId ;
237- expect ( ( ) => {
238- utils . getPublisherId ( bidderRequest ) ;
239- } ) . to . throw ( ) ;
240- } ) ;
241- } )
242-
243195 describe ( 'getOrtbId' , function ( ) {
244196 it ( 'should return the ortbId from the prebid request object (i.e bidderRequestId)' , function ( ) {
245197 expect ( utils . getOrtbId ( bidderRequest ) ) . to . equal ( bidderRequest . bidderRequestId ) ;
@@ -270,46 +222,5 @@ describe('Mobkoi bidding Adapter', function () {
270222 } ) . to . throw ( ) ;
271223 } ) ;
272224 } )
273-
274- describe ( 'replaceAllMacrosInPlace' , function ( ) {
275- let bidderResponse , bidRequest , bidderRequest ;
276-
277- beforeEach ( function ( ) {
278- bidderRequest = getBidderRequest ( ) ;
279- bidRequest = spec . buildRequests ( bidderRequest . bids , bidderRequest ) ;
280- bidderResponse = getBidderResponse ( ) ;
281- } ) ;
282-
283- it ( 'should replace all macros in adm, nurl, and lurl fields' , function ( ) {
284- const bid = bidderResponse . body . seatbid [ 0 ] . bid [ 0 ] ;
285- bid . nurl = '${BIDDING_API_BASE_URL}/win?price=${AUCTION_PRICE}&impressionId=${AUCTION_IMP_ID}¤cy=${AUCTION_CURRENCY}&campaignId=${CAMPAIGN_ID}&creativeId=${CREATIVE_ID}&publisherId=${PUBLISHER_ID}&ortbId=${ORTB_ID}' ;
286- bid . lurl = '${BIDDING_API_BASE_URL}/loss?price=${AUCTION_PRICE}&impressionId=${AUCTION_IMP_ID}¤cy=${AUCTION_CURRENCY}&campaignId=${CAMPAIGN_ID}&creativeId=${CREATIVE_ID}&publisherId=${PUBLISHER_ID}&ortbId=${ORTB_ID}' ;
287- bid . adm = '<div>${AUCTION_PRICE}${AUCTION_CURRENCY}${AUCTION_IMP_ID}${AUCTION_BID_ID}${CAMPAIGN_ID}${CREATIVE_ID}${PUBLISHER_ID}${ORTB_ID}${BIDDING_API_BASE_URL}</div>' ;
288-
289- const BIDDING_API_BASE_URL = testAdServerBaseUrl ;
290- const AUCTION_CURRENCY = bidderResponse . body . cur ;
291- const AUCTION_BID_ID = bidderRequest . auctionId ;
292- const AUCTION_PRICE = bid . price ;
293- const AUCTION_IMP_ID = bid . impid ;
294- const CREATIVE_ID = bid . crid ;
295- const CAMPAIGN_ID = bid . cid ;
296- const PUBLISHER_ID = bidderRequest . ortb2 . site . publisher . id ;
297- const ORTB_ID = bidderResponse . body . id ;
298-
299- const context = {
300- bidRequest,
301- bidderRequest
302- }
303- utils . replaceAllMacrosInPlace ( bid , context ) ;
304-
305- expect ( bid . adm ) . to . equal ( `<div>${ AUCTION_PRICE } ${ AUCTION_CURRENCY } ${ AUCTION_IMP_ID } ${ AUCTION_BID_ID } ${ CAMPAIGN_ID } ${ CREATIVE_ID } ${ PUBLISHER_ID } ${ ORTB_ID } ${ BIDDING_API_BASE_URL } </div>` ) ;
306- expect ( bid . lurl ) . to . equal (
307- `${ BIDDING_API_BASE_URL } /loss?price=${ AUCTION_PRICE } &impressionId=${ AUCTION_IMP_ID } ¤cy=${ AUCTION_CURRENCY } &campaignId=${ CAMPAIGN_ID } &creativeId=${ CREATIVE_ID } &publisherId=${ PUBLISHER_ID } &ortbId=${ ORTB_ID } `
308- ) ;
309- expect ( bid . nurl ) . to . equal (
310- `${ BIDDING_API_BASE_URL } /win?price=${ AUCTION_PRICE } &impressionId=${ AUCTION_IMP_ID } ¤cy=${ AUCTION_CURRENCY } &campaignId=${ CAMPAIGN_ID } &creativeId=${ CREATIVE_ID } &publisherId=${ PUBLISHER_ID } &ortbId=${ ORTB_ID } `
311- ) ;
312- } ) ;
313- } )
314225 } )
315226} )
0 commit comments