1
1
import { expect } from 'chai'
2
2
import { spec , getTimeoutUrl } from 'modules/seedtagBidAdapter.js'
3
+ import * as utils from 'src/utils.js'
3
4
4
5
const PUBLISHER_ID = '0000-0000-01'
5
6
const ADUNIT_ID = '000000'
@@ -42,7 +43,7 @@ describe('Seedtag Adapter', function() {
42
43
}
43
44
)
44
45
}
45
- const placements = [ 'banner' , 'video' , 'inImage' , 'inScreen' ]
46
+ const placements = [ 'banner' , 'video' , 'inImage' , 'inScreen' , 'inArticle' ]
46
47
placements . forEach ( placement => {
47
48
it ( 'should be ' + placement , function ( ) {
48
49
const isBidRequestValid = spec . isBidRequestValid (
@@ -53,7 +54,7 @@ describe('Seedtag Adapter', function() {
53
54
} )
54
55
} )
55
56
} )
56
- describe ( 'when video slot has all mandatory params. ' , function ( ) {
57
+ describe ( 'when video slot has all mandatory params' , function ( ) {
57
58
it ( 'should return true, when video mediatype object are correct.' , function ( ) {
58
59
const slotConfig = getSlotConfigs (
59
60
{
@@ -116,7 +117,7 @@ describe('Seedtag Adapter', function() {
116
117
expect ( isBidRequestValid ) . to . equal ( false )
117
118
} )
118
119
} )
119
- describe ( 'when video mediaType object is not correct. ' , function ( ) {
120
+ describe ( 'when video mediaType object is not correct' , function ( ) {
120
121
function createVideoSlotconfig ( mediaType ) {
121
122
return getSlotConfigs ( mediaType , {
122
123
publisherId : PUBLISHER_ID ,
@@ -301,7 +302,7 @@ describe('Seedtag Adapter', function() {
301
302
expect ( typeof bids ) . to . equal ( 'object' )
302
303
expect ( bids . length ) . to . equal ( 0 )
303
304
} )
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 ( ) {
305
306
const request = { data : JSON . stringify ( { } ) }
306
307
const serverResponse = { body : { bids : [ ] } }
307
308
const bids = spec . interpretResponse ( serverResponse , request )
@@ -323,7 +324,8 @@ describe('Seedtag Adapter', function() {
323
324
width : 728 ,
324
325
height : 90 ,
325
326
mediaType : 'display' ,
326
- ttl : 360
327
+ ttl : 360 ,
328
+ nurl : 'testurl.com/nurl'
327
329
}
328
330
] ,
329
331
cookieSync : { url : '' }
@@ -338,6 +340,7 @@ describe('Seedtag Adapter', function() {
338
340
expect ( bids [ 0 ] . currency ) . to . equal ( 'USD' )
339
341
expect ( bids [ 0 ] . netRevenue ) . to . equal ( true )
340
342
expect ( bids [ 0 ] . ad ) . to . equal ( 'content' )
343
+ expect ( bids [ 0 ] . nurl ) . to . equal ( 'testurl.com/nurl' )
341
344
} )
342
345
} )
343
346
describe ( 'the bid is a video' , function ( ) {
@@ -354,7 +357,8 @@ describe('Seedtag Adapter', function() {
354
357
width : 728 ,
355
358
height : 90 ,
356
359
mediaType : 'video' ,
357
- ttl : 360
360
+ ttl : 360 ,
361
+ nurl : undefined
358
362
}
359
363
] ,
360
364
cookieSync : { url : '' }
@@ -416,4 +420,33 @@ describe('Seedtag Adapter', function() {
416
420
)
417
421
} )
418
422
} )
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
+ } )
419
452
} )
0 commit comments