From c84753f44158864e5cf408fd883d3601c8c5a2d5 Mon Sep 17 00:00:00 2001 From: vrtcal-dev Date: Fri, 4 Oct 2019 12:59:16 +0000 Subject: [PATCH 1/3] Added 3 key Vrtcal Adapter files: adapter,markdown,unit tests --- modules/vrtcalBidAdapter.js | 84 ++++++++++++++++++++++ modules/vrtcalBidAdapter.md | 30 ++++++++ test/spec/modules/vrtcalBidAdapter_spec.js | 81 +++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 modules/vrtcalBidAdapter.js create mode 100644 modules/vrtcalBidAdapter.md create mode 100644 test/spec/modules/vrtcalBidAdapter_spec.js diff --git a/modules/vrtcalBidAdapter.js b/modules/vrtcalBidAdapter.js new file mode 100644 index 00000000000..1df3d52dbb9 --- /dev/null +++ b/modules/vrtcalBidAdapter.js @@ -0,0 +1,84 @@ +import {registerBidder} from '../src/adapters/bidderFactory'; +import { BANNER } from '../src/mediaTypes'; +import {ajax} from '../src/ajax'; + +export const spec = { + code: 'vrtcal', + supportedMediaTypes: [BANNER], + isBidRequestValid: function (bid) { + return true;// No extras params required + }, + buildRequests: function (bidRequests) { + const requests = bidRequests.map(function (bid) { + const params = { + + prebidJS: 1, + prebidAdUnitCode: bid.adUnitCode, + id: bid.bidId, + imp: [{ + id: '1', + banner: { + w: bid.sizes[0][0], + h: bid.sizes[0][1], + }, + bidfloor: 0.75 + }], + site: { + id: 'VRTCAL_FILLED', + name: 'VRTCAL_FILLED', + cat: ['VRTCAL_FILLED'], + domain: decodeURIComponent(window.location.href).replace('https://', '').replace('http://', '').split('/')[0] + + }, + device: { + ua: 'VRTCAL_FILLED', + ip: 'VRTCAL_FILLED' + } + }; + + return {method: 'POST', url: 'https://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804', data: JSON.stringify(params), options: {withCredentials: false, crossOrigin: true}} + }); + + return requests; + }, + interpretResponse: function (serverResponse, bidRequest) { + if (!serverResponse || !serverResponse.body) { + return []; + } + + const bidResponses = []; + + var response = serverResponse.body; + + if (response) { + const bidResponse = { + requestId: response.id, + cpm: response.seatbid[0].bid[0].price, + width: response.seatbid[0].bid[0].w, + height: response.seatbid[0].bid[0].h, + creativeId: response.seatbid[0].bid[0].crid, + currency: 'USD', + netRevenue: true, + ttl: 900, + ad: response.seatbid[0].bid[0].adm, + nurl: response.seatbid[0].bid[0].nurl + }; + + bidResponses.push(bidResponse); + } + return bidResponses; + }, + getUserSyncs: function(syncOptions, serverResponses) { + return []; + }, + onBidWon: function(bid) { + if (!bid.nurl) { return; } + const winUrl = bid.nurl.replace( + /\$\{AUCTION_PRICE\}/, + bid.cpm + ); + ajax(winUrl, null); + } +}; + +registerBidder(spec); diff --git a/modules/vrtcalBidAdapter.md b/modules/vrtcalBidAdapter.md new file mode 100644 index 00000000000..8d2809f7d5d --- /dev/null +++ b/modules/vrtcalBidAdapter.md @@ -0,0 +1,30 @@ +# Overview + +Module Name: Vrtcal Bidder Adapter +Module Type: Bidder Adapter +Maintainer: support@vrtcal.com + +# Description + +You can use this adapter to get a bid from vrtcal.com. + + +# Test Parameters +``` + var adUnits = [ + { + code: "vrtcal-test-adunit", + mediaTypes: { + banner: { + sizes: [[300, 250]] + } + }, + bids: [ + { + bidder: "vrtcal" + } + ] + } + ]; +``` +#Vrtcal requires no extra params passed, thus no params struct included diff --git a/test/spec/modules/vrtcalBidAdapter_spec.js b/test/spec/modules/vrtcalBidAdapter_spec.js new file mode 100644 index 00000000000..b28027d150d --- /dev/null +++ b/test/spec/modules/vrtcalBidAdapter_spec.js @@ -0,0 +1,81 @@ +import { expect } from 'chai' +import { spec } from 'modules/vrtcalBidAdapter' +import { newBidder } from 'src/adapters/bidderFactory' + +describe('vrtcalBidAdapter', function () { + const adapter = newBidder(spec) + + let bidRequest = { + bidId: 'bidID0001', + transactionId: 'transID0001', + sizes: [[ 300, 250 ]] + } + + describe('isBidRequestValid', function () { + it('should return true 100% of time as no special additional params are required, thus no additional validation needed', function () { + expect(spec.isBidRequestValid(bidRequest)).to.be.true + }) + }) + + describe('buildRequests', function () { + let bidRequests = [ + { + 'bidder': 'vrtcal', + 'adUnitCode': 'adunit0001', + 'sizes': [[300, 250]], + 'bidId': 'bidID0001', + 'bidderRequestId': 'br0001', + 'auctionId': 'auction0001', + } + ]; + + const request = spec.buildRequests(bidRequests); + + it('sends bid request to our endpoint via POST', function () { + expect(request[0].method).to.equal('POST'); + }); + + it('adUnitCode should be sent as prebidAdUnitCode parameters on any requests', function () { + expect(request[0].data).to.match(/"prebidAdUnitCode":"adunit0001"/); + }); + }); + + describe('interpretResponse', function () { + it('should form compliant bid object response', function () { + let res = { + body: { + id: 'bidID0001', + seatbid: [{ + bid: [{ + id: 'VRTB_240d3c8a3c12b68_1', + impid: '1', + price: 0.7554, + adm: 'TEST AD', + nurl: 'https://exchange.vrtcal.com/wintracker', + w: 300, + h: 250, + crid: 'v2_1064_vrt_vrtcaltestdisplay2_300_250', + adomain: ['vrtcal.com'] + }], + seat: '16' + }], + cur: 'USD' + } + } + + let ir = spec.interpretResponse(res, bidRequest) + + expect(ir.length).to.equal(1) + + let en = ir[0] + + expect(en.requestId != null && + en.cpm != null && typeof en.cpm === 'number' && + en.width != null && typeof en.width === 'number' && + en.height != null && typeof en.height === 'number' && + en.ad != null && + en.creativeId != null + ).to.be.true + }) + }) +}) From b3bba20619e36ac3750ea89f1cb68b77ac17af01 Mon Sep 17 00:00:00 2001 From: vrtcal-dev Date: Wed, 16 Oct 2019 14:43:30 +0000 Subject: [PATCH 2/3] Removed unused getUserSyncs;Added mediaTypes.banner.sizes support;Raised test coverage to 85% --- modules/vrtcalBidAdapter.js | 24 ++- test/spec/modules/vrtcalBidAdapter_spec.js | 200 ++++++++++++++------- 2 files changed, 155 insertions(+), 69 deletions(-) diff --git a/modules/vrtcalBidAdapter.js b/modules/vrtcalBidAdapter.js index 1df3d52dbb9..37c15cc964e 100644 --- a/modules/vrtcalBidAdapter.js +++ b/modules/vrtcalBidAdapter.js @@ -6,7 +6,10 @@ export const spec = { code: 'vrtcal', supportedMediaTypes: [BANNER], isBidRequestValid: function (bid) { - return true;// No extras params required + if(bid.bidId=="" || bid.auctionId=="") + return false; + else + return true;// No extras params required }, buildRequests: function (bidRequests) { const requests = bidRequests.map(function (bid) { @@ -18,8 +21,6 @@ export const spec = { imp: [{ id: '1', banner: { - w: bid.sizes[0][0], - h: bid.sizes[0][1], }, bidfloor: 0.75 }], @@ -36,6 +37,16 @@ export const spec = { } }; + if (typeof(bid.mediaTypes) !== 'undefined' && typeof(bid.mediaTypes.banner) !== 'undefined' && typeof(bid.mediaTypes.banner.sizes) !== 'undefined') { + params.imp[0].banner.w = bid.mediaTypes.banner.sizes[0][0]; + params.imp[0].banner.h = bid.mediaTypes.banner.sizes[0][1]; + + } + else { + params.imp[0].banner.w = bid.sizes[0][0]; + params.imp[0].banner.h = bid.sizes[0][1]; + } + return {method: 'POST', url: 'https://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804', data: JSON.stringify(params), options: {withCredentials: false, crossOrigin: true}} }); @@ -68,17 +79,16 @@ export const spec = { } return bidResponses; }, - getUserSyncs: function(syncOptions, serverResponses) { - return []; - }, onBidWon: function(bid) { - if (!bid.nurl) { return; } + if (!bid.nurl) { return false; } const winUrl = bid.nurl.replace( /\$\{AUCTION_PRICE\}/, bid.cpm ); ajax(winUrl, null); + return true; } }; + registerBidder(spec); diff --git a/test/spec/modules/vrtcalBidAdapter_spec.js b/test/spec/modules/vrtcalBidAdapter_spec.js index b28027d150d..fce123b7193 100644 --- a/test/spec/modules/vrtcalBidAdapter_spec.js +++ b/test/spec/modules/vrtcalBidAdapter_spec.js @@ -1,81 +1,157 @@ -import { expect } from 'chai' -import { spec } from 'modules/vrtcalBidAdapter' -import { newBidder } from 'src/adapters/bidderFactory' +import {expect} from 'chai'; +import {spec} from '../../../modules/vrtcalBidAdapter'; -describe('vrtcalBidAdapter', function () { - const adapter = newBidder(spec) - - let bidRequest = { +describe('Vrtcal Adapter', function () { + let bid = { bidId: 'bidID0001', - transactionId: 'transID0001', - sizes: [[ 300, 250 ]] - } + bidder: 'vrtcal', + bidderRequestId: 'brID0001', + auctionId: 'auID0001', + sizes: [[300, 250]], + transactionId: 'tid0001', + adUnitCode: 'vrtcal-test-adunit' + }; describe('isBidRequestValid', function () { - it('should return true 100% of time as no special additional params are required, thus no additional validation needed', function () { - expect(spec.isBidRequestValid(bidRequest)).to.be.true - }) - }) + it('Should return true when base params as set', function () { + expect(spec.isBidRequestValid(bid)).to.be.true; + }); + it('Should return false when bid.bidId is blank', function () { + bid.bidId = ''; + expect(spec.isBidRequestValid(bid)).to.be.false; + }); + it('Should return false when bid.auctionId is blank', function () { + bid.auctionId = ''; + expect(spec.isBidRequestValid(bid)).to.be.false; + }); + }); describe('buildRequests', function () { - let bidRequests = [ - { - 'bidder': 'vrtcal', - 'adUnitCode': 'adunit0001', - 'sizes': [[300, 250]], - 'bidId': 'bidID0001', - 'bidderRequestId': 'br0001', - 'auctionId': 'auction0001', - } - ]; + let serverRequests = spec.buildRequests([bid]); - const request = spec.buildRequests(bidRequests); + let serverRequest = serverRequests[0]; - it('sends bid request to our endpoint via POST', function () { - expect(request[0].method).to.equal('POST'); + it('Creates a ServerRequest object with method, URL and data', function () { + expect(serverRequest).to.exist; + expect(serverRequest.method).to.exist; + expect(serverRequest.url).to.exist; + expect(serverRequest.data).to.exist; }); + it('Returns POST method', function () { + expect(serverRequest.method).to.equal('POST'); + }); + it('Returns valid URL', function () { + expect(serverRequest.url).to.equal('https://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804'); + }); + - it('adUnitCode should be sent as prebidAdUnitCode parameters on any requests', function () { - expect(request[0].data).to.match(/"prebidAdUnitCode":"adunit0001"/); + it('Returns valid data if array of bids is valid', function () { + let data = JSON.parse(serverRequest.data); + expect(data).to.be.an('object'); + expect(data).to.have.all.keys('prebidJS','prebidAdUnitCode', 'id','imp','site','device'); + expect(data.prebidJS).to.not.equal(''); + expect(data.prebidAdUnitCode).to.not.equal(''); + }); + + it('Sets width and height based on existence of bid.mediaTypes.banner', function () { + let data = JSON.parse(serverRequest.data); + if(typeof(bid.mediaTypes) !== 'undefined' && typeof(bid.mediaTypes.banner) !== 'undefined' && typeof(bid.mediaTypes.banner.sizes) !== 'undefined') { + expect(data.imp[0].banner.w).to.equal(bid.mediaTypes.banner.sizes[0][0]); + expect(data.imp[0].banner.h).to.equal(bid.mediaTypes.banner.sizes[0][1]); + } + else { + expect(data.imp[0].banner.w).to.equal(bid.sizes[0][0]); + expect(data.imp[0].banner.h).to.equal(bid.sizes[0][1]); + } + }); + + + + + it('Returns empty data if no valid requests are passed', function () { + serverRequests = spec.buildRequests([]); + expect(serverRequests).to.be.an('array').that.is.empty; }); }); describe('interpretResponse', function () { - it('should form compliant bid object response', function () { - let res = { - body: { - id: 'bidID0001', - seatbid: [{ - bid: [{ - id: 'VRTB_240d3c8a3c12b68_1', - impid: '1', - price: 0.7554, - adm: 'TEST AD', - nurl: 'https://exchange.vrtcal.com/wintracker', - w: 300, - h: 250, - crid: 'v2_1064_vrt_vrtcaltestdisplay2_300_250', - adomain: ['vrtcal.com'] - }], - seat: '16' - }], - cur: 'USD' - } + let bid = { + bidId: 'bidID0001', + bidder: 'vrtcal', + bidderRequestId: 'brID0001', + auctionId: 'auID0001', + sizes: [[300, 250]], + transactionId: 'tid0001', + adUnitCode: 'vrtcal-test-adunit' + }; + + + + + + + let serverRequests = spec.buildRequests([bid]); + + let resObject = {body:{id:'vrtcal-test-id',width:300,height:250,seatbid:[{bid:[{price:3.0,w:300,h:250,crid:'testcrid',adm:'testad',nurl:'https://vrtcal.com/faketracker'}]}],currency:'USD',netRevenue:true,ttl:900}}; + + let serverResponses = spec.interpretResponse(resObject,serverRequests); + + it('Returns an array of valid server responses if response object is valid', function () { + + expect(serverResponses).to.be.an('array').that.is.not.empty; + for (let i = 0; i < serverResponses.length; i++) { + let dataItem = serverResponses[i]; + expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId', + 'netRevenue', 'currency','nurl'); + expect(dataItem.requestId).to.be.a('string'); + expect(dataItem.cpm).to.be.a('number'); + expect(dataItem.width).to.be.a('number'); + expect(dataItem.height).to.be.a('number'); + expect(dataItem.ad).to.be.a('string'); + expect(dataItem.ttl).to.be.a('number'); + expect(dataItem.creativeId).to.be.a('string'); + expect(dataItem.netRevenue).to.be.a('boolean'); + expect(dataItem.currency).to.be.a('string'); + expect(dataItem.nurl).to.be.a('string'); + } - let ir = spec.interpretResponse(res, bidRequest) + it('Returns an empty array if invalid response is passed', function () { + serverResponses = spec.interpretResponse('invalid_response'); + expect(serverResponses).to.be.an('array').that.is.empty; + }); + }); - expect(ir.length).to.equal(1) + }); + + + + + + describe('onBidWon', function () { + let bid = { + bidId: '2dd581a2b6281d', + bidder: 'vrtcal', + bidderRequestId: '145e1d6a7837c9', + auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2', + sizes: [[300, 250]], + transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62', + adUnitCode: 'vrtcal-test-adunit' + }; + + + let serverRequests = spec.buildRequests([bid]); + let resObject = {body:{id:'vrtcal-test-id',width:300,height:250,seatbid:[{bid:[{price:3.0,w:300,h:250,crid:'testcrid',adm:'testad',nurl:'https://vrtcal.com/faketracker'}]}],currency:'USD',netRevenue:true,ttl:900}}; + let serverResponses = spec.interpretResponse(resObject,serverRequests); + let wonbid = serverResponses[0]; + + + it('Returns true is nurl is good/not blank', function () { + expect(wonbid.nurl).to.not.equal(''); + expect(spec.onBidWon(wonbid)).to.be.true; + }); + + }); - let en = ir[0] - expect(en.requestId != null && - en.cpm != null && typeof en.cpm === 'number' && - en.width != null && typeof en.width === 'number' && - en.height != null && typeof en.height === 'number' && - en.ad != null && - en.creativeId != null - ).to.be.true - }) - }) -}) +}); From 08b89345c63a1ed71831b1b5c9ea7c8162dbefa1 Mon Sep 17 00:00:00 2001 From: vrtcal-dev Date: Thu, 24 Oct 2019 18:25:28 +0000 Subject: [PATCH 3/3] lint formatting errors corrected --- modules/vrtcalBidAdapter.js | 20 ++--- test/spec/modules/vrtcalBidAdapter_spec.js | 88 ++++++++-------------- 2 files changed, 40 insertions(+), 68 deletions(-) diff --git a/modules/vrtcalBidAdapter.js b/modules/vrtcalBidAdapter.js index 37c15cc964e..139f985ed67 100644 --- a/modules/vrtcalBidAdapter.js +++ b/modules/vrtcalBidAdapter.js @@ -6,10 +6,7 @@ export const spec = { code: 'vrtcal', supportedMediaTypes: [BANNER], isBidRequestValid: function (bid) { - if(bid.bidId=="" || bid.auctionId=="") - return false; - else - return true;// No extras params required + if (bid.bidId == '' || bid.auctionId == '') { return false; } else { return true; }// No extras params required }, buildRequests: function (bidRequests) { const requests = bidRequests.map(function (bid) { @@ -37,14 +34,12 @@ export const spec = { } }; - if (typeof(bid.mediaTypes) !== 'undefined' && typeof(bid.mediaTypes.banner) !== 'undefined' && typeof(bid.mediaTypes.banner.sizes) !== 'undefined') { - params.imp[0].banner.w = bid.mediaTypes.banner.sizes[0][0]; - params.imp[0].banner.h = bid.mediaTypes.banner.sizes[0][1]; - - } - else { - params.imp[0].banner.w = bid.sizes[0][0]; - params.imp[0].banner.h = bid.sizes[0][1]; + if (typeof (bid.mediaTypes) !== 'undefined' && typeof (bid.mediaTypes.banner) !== 'undefined' && typeof (bid.mediaTypes.banner.sizes) !== 'undefined') { + params.imp[0].banner.w = bid.mediaTypes.banner.sizes[0][0]; + params.imp[0].banner.h = bid.mediaTypes.banner.sizes[0][1]; + } else { + params.imp[0].banner.w = bid.sizes[0][0]; + params.imp[0].banner.h = bid.sizes[0][1]; } return {method: 'POST', url: 'https://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804', data: JSON.stringify(params), options: {withCredentials: false, crossOrigin: true}} @@ -90,5 +85,4 @@ export const spec = { } }; - registerBidder(spec); diff --git a/test/spec/modules/vrtcalBidAdapter_spec.js b/test/spec/modules/vrtcalBidAdapter_spec.js index fce123b7193..7b37e393575 100644 --- a/test/spec/modules/vrtcalBidAdapter_spec.js +++ b/test/spec/modules/vrtcalBidAdapter_spec.js @@ -44,30 +44,25 @@ describe('Vrtcal Adapter', function () { expect(serverRequest.url).to.equal('https://rtb.vrtcal.com/bidder_prebid.vap?ssp=1804'); }); - it('Returns valid data if array of bids is valid', function () { let data = JSON.parse(serverRequest.data); expect(data).to.be.an('object'); - expect(data).to.have.all.keys('prebidJS','prebidAdUnitCode', 'id','imp','site','device'); + expect(data).to.have.all.keys('prebidJS', 'prebidAdUnitCode', 'id', 'imp', 'site', 'device'); expect(data.prebidJS).to.not.equal(''); expect(data.prebidAdUnitCode).to.not.equal(''); }); it('Sets width and height based on existence of bid.mediaTypes.banner', function () { let data = JSON.parse(serverRequest.data); - if(typeof(bid.mediaTypes) !== 'undefined' && typeof(bid.mediaTypes.banner) !== 'undefined' && typeof(bid.mediaTypes.banner.sizes) !== 'undefined') { + if (typeof (bid.mediaTypes) !== 'undefined' && typeof (bid.mediaTypes.banner) !== 'undefined' && typeof (bid.mediaTypes.banner.sizes) !== 'undefined') { expect(data.imp[0].banner.w).to.equal(bid.mediaTypes.banner.sizes[0][0]); expect(data.imp[0].banner.h).to.equal(bid.mediaTypes.banner.sizes[0][1]); - } - else { + } else { expect(data.imp[0].banner.w).to.equal(bid.sizes[0][0]); expect(data.imp[0].banner.h).to.equal(bid.sizes[0][1]); } }); - - - it('Returns empty data if no valid requests are passed', function () { serverRequests = spec.buildRequests([]); expect(serverRequests).to.be.an('array').that.is.empty; @@ -75,34 +70,28 @@ describe('Vrtcal Adapter', function () { }); describe('interpretResponse', function () { - let bid = { - bidId: 'bidID0001', - bidder: 'vrtcal', - bidderRequestId: 'brID0001', - auctionId: 'auID0001', - sizes: [[300, 250]], - transactionId: 'tid0001', - adUnitCode: 'vrtcal-test-adunit' - }; - - - - + let bid = { + bidId: 'bidID0001', + bidder: 'vrtcal', + bidderRequestId: 'brID0001', + auctionId: 'auID0001', + sizes: [[300, 250]], + transactionId: 'tid0001', + adUnitCode: 'vrtcal-test-adunit' + }; + let serverRequests = spec.buildRequests([bid]); - let serverRequests = spec.buildRequests([bid]); - - let resObject = {body:{id:'vrtcal-test-id',width:300,height:250,seatbid:[{bid:[{price:3.0,w:300,h:250,crid:'testcrid',adm:'testad',nurl:'https://vrtcal.com/faketracker'}]}],currency:'USD',netRevenue:true,ttl:900}}; + let resObject = {body: {id: 'vrtcal-test-id', width: 300, height: 250, seatbid: [{bid: [{price: 3.0, w: 300, h: 250, crid: 'testcrid', adm: 'testad', nurl: 'https://vrtcal.com/faketracker'}]}], currency: 'USD', netRevenue: true, ttl: 900}}; - let serverResponses = spec.interpretResponse(resObject,serverRequests); + let serverResponses = spec.interpretResponse(resObject, serverRequests); it('Returns an array of valid server responses if response object is valid', function () { - expect(serverResponses).to.be.an('array').that.is.not.empty; for (let i = 0; i < serverResponses.length; i++) { let dataItem = serverResponses[i]; expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId', - 'netRevenue', 'currency','nurl'); + 'netRevenue', 'currency', 'nurl'); expect(dataItem.requestId).to.be.a('string'); expect(dataItem.cpm).to.be.a('number'); expect(dataItem.width).to.be.a('number'); @@ -113,7 +102,6 @@ describe('Vrtcal Adapter', function () { expect(dataItem.netRevenue).to.be.a('boolean'); expect(dataItem.currency).to.be.a('string'); expect(dataItem.nurl).to.be.a('string'); - } it('Returns an empty array if invalid response is passed', function () { @@ -121,37 +109,27 @@ describe('Vrtcal Adapter', function () { expect(serverResponses).to.be.an('array').that.is.empty; }); }); - }); - - - - describe('onBidWon', function () { - let bid = { - bidId: '2dd581a2b6281d', - bidder: 'vrtcal', - bidderRequestId: '145e1d6a7837c9', - auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2', - sizes: [[300, 250]], - transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62', - adUnitCode: 'vrtcal-test-adunit' - }; - - - let serverRequests = spec.buildRequests([bid]); - let resObject = {body:{id:'vrtcal-test-id',width:300,height:250,seatbid:[{bid:[{price:3.0,w:300,h:250,crid:'testcrid',adm:'testad',nurl:'https://vrtcal.com/faketracker'}]}],currency:'USD',netRevenue:true,ttl:900}}; - let serverResponses = spec.interpretResponse(resObject,serverRequests); - let wonbid = serverResponses[0]; + let bid = { + bidId: '2dd581a2b6281d', + bidder: 'vrtcal', + bidderRequestId: '145e1d6a7837c9', + auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2', + sizes: [[300, 250]], + transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62', + adUnitCode: 'vrtcal-test-adunit' + }; - - it('Returns true is nurl is good/not blank', function () { - expect(wonbid.nurl).to.not.equal(''); - expect(spec.onBidWon(wonbid)).to.be.true; - }); + let serverRequests = spec.buildRequests([bid]); + let resObject = {body: {id: 'vrtcal-test-id', width: 300, height: 250, seatbid: [{bid: [{price: 3.0, w: 300, h: 250, crid: 'testcrid', adm: 'testad', nurl: 'https://vrtcal.com/faketracker'}]}], currency: 'USD', netRevenue: true, ttl: 900}}; + let serverResponses = spec.interpretResponse(resObject, serverRequests); + let wonbid = serverResponses[0]; + it('Returns true is nurl is good/not blank', function () { + expect(wonbid.nurl).to.not.equal(''); + expect(spec.onBidWon(wonbid)).to.be.true; + }); }); - - });