11import { expect } from 'chai'
22import { spec , getTimeoutUrl } from 'modules/seedtagBidAdapter.js'
3+ import * as utils from 'src/utils.js'
34
45const PUBLISHER_ID = '0000-0000-01'
56const ADUNIT_ID = '000000'
@@ -42,7 +43,7 @@ describe('Seedtag Adapter', function() {
4243 }
4344 )
4445 }
45- const placements = [ 'banner' , 'video' , 'inImage' , 'inScreen' ]
46+ const placements = [ 'banner' , 'video' , 'inImage' , 'inScreen' , 'inArticle' ]
4647 placements . forEach ( placement => {
4748 it ( 'should be ' + placement , function ( ) {
4849 const isBidRequestValid = spec . isBidRequestValid (
@@ -53,7 +54,7 @@ describe('Seedtag Adapter', function() {
5354 } )
5455 } )
5556 } )
56- describe ( 'when video slot has all mandatory params. ' , function ( ) {
57+ describe ( 'when video slot has all mandatory params' , function ( ) {
5758 it ( 'should return true, when video mediatype object are correct.' , function ( ) {
5859 const slotConfig = getSlotConfigs (
5960 {
@@ -116,7 +117,7 @@ describe('Seedtag Adapter', function() {
116117 expect ( isBidRequestValid ) . to . equal ( false )
117118 } )
118119 } )
119- describe ( 'when video mediaType object is not correct. ' , function ( ) {
120+ describe ( 'when video mediaType object is not correct' , function ( ) {
120121 function createVideoSlotconfig ( mediaType ) {
121122 return getSlotConfigs ( mediaType , {
122123 publisherId : PUBLISHER_ID ,
@@ -301,7 +302,7 @@ describe('Seedtag Adapter', function() {
301302 expect ( typeof bids ) . to . equal ( 'object' )
302303 expect ( bids . length ) . to . equal ( 0 )
303304 } )
304- it ( 'should return a void array, when the server response have not got bids.' , function ( ) {
305+ it ( 'should return a void array, when the server response have no bids.' , function ( ) {
305306 const request = { data : JSON . stringify ( { } ) }
306307 const serverResponse = { body : { bids : [ ] } }
307308 const bids = spec . interpretResponse ( serverResponse , request )
@@ -323,7 +324,8 @@ describe('Seedtag Adapter', function() {
323324 width : 728 ,
324325 height : 90 ,
325326 mediaType : 'display' ,
326- ttl : 360
327+ ttl : 360 ,
328+ nurl : 'testurl.com/nurl'
327329 }
328330 ] ,
329331 cookieSync : { url : '' }
@@ -338,6 +340,7 @@ describe('Seedtag Adapter', function() {
338340 expect ( bids [ 0 ] . currency ) . to . equal ( 'USD' )
339341 expect ( bids [ 0 ] . netRevenue ) . to . equal ( true )
340342 expect ( bids [ 0 ] . ad ) . to . equal ( 'content' )
343+ expect ( bids [ 0 ] . nurl ) . to . equal ( 'testurl.com/nurl' )
341344 } )
342345 } )
343346 describe ( 'the bid is a video' , function ( ) {
@@ -354,7 +357,8 @@ describe('Seedtag Adapter', function() {
354357 width : 728 ,
355358 height : 90 ,
356359 mediaType : 'video' ,
357- ttl : 360
360+ ttl : 360 ,
361+ nurl : undefined
358362 }
359363 ] ,
360364 cookieSync : { url : '' }
@@ -416,4 +420,33 @@ describe('Seedtag Adapter', function() {
416420 )
417421 } )
418422 } )
423+
424+ describe ( 'onBidWon' , function ( ) {
425+ beforeEach ( function ( ) {
426+ sinon . stub ( utils , 'triggerPixel' )
427+ } )
428+
429+ afterEach ( function ( ) {
430+ utils . triggerPixel . restore ( )
431+ } )
432+
433+ describe ( 'without nurl' , function ( ) {
434+ const bid = { }
435+
436+ it ( 'does not create pixel ' , function ( ) {
437+ spec . onBidWon ( bid )
438+ expect ( utils . triggerPixel . called ) . to . equal ( false ) ;
439+ } )
440+ } )
441+
442+ describe ( 'with nurl' , function ( ) {
443+ const nurl = 'http://seedtag_domain/won'
444+ const bid = { nurl }
445+
446+ it ( 'creates nurl pixel if bid nurl' , function ( ) {
447+ spec . onBidWon ( { nurl } )
448+ expect ( utils . triggerPixel . calledWith ( nurl ) ) . to . equal ( true ) ;
449+ } )
450+ } )
451+ } )
419452} )
0 commit comments