Skip to content

Commit

Permalink
ucfunnel adapter fix error message in debug mode (prebid#4338)
Browse files Browse the repository at this point in the history
* Add a new ucfunnel Adapter and test page

* Add a new ucfunnel Adapter and test page

* 1. Use prebid lib in the repo to keep updated
2. Replace var with let
3. Put JSON.parse(JSON.stringify()) into try catch block

* utils.getTopWindowLocation is a function

* Change to modules from adapters

* Migrate to module design

* [Dev Fix] Remove width and height which can be got from ad unit id

* Update ucfunnelBidAdapter to fit into new spec

* Correct the endpoint. Fix the error of query string

* Add test case for ucfunnelBidAdapter

* Fix lint error

* Update version number

* Combine all checks on bid request

* Add GDPR support for ucfunnel adapter

* Add in-stream video and native support for ucfunnel adapter

* Remove demo page. Add more test cases.

* Change request method from POST to GET

* Remove unnecessary comment

* Support vastXml and vastUrl for video request

* update TTL to 30 mins

* Avoid using arrow function which is not discuraged in mocha

* ucfunnel tdid support

* ucfunnel fix error message in debug mode
  • Loading branch information
ucfunnel authored and afewcc committed Dec 10, 2019
1 parent 6452f88 commit 388cd71
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/ucfunnelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const spec = {
let bid = {
requestId: bidRequest.bidId,
cpm: ad.cpm || 0,
creativeId: ad.ad_id,
creativeId: ad.ad_id || bidRequest.params.adid,
dealId: ad.deal || null,
currency: 'USD',
netRevenue: true,
Expand Down Expand Up @@ -108,10 +108,11 @@ export const spec = {
break;
case BANNER:
default:
var size = parseSizes(bidRequest);
Object.assign(bid, {
width: ad.width,
height: ad.height,
ad: ad.adm
width: ad.width || size[0],
height: ad.height || size[1],
ad: ad.adm || ''
});
}

Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/ucfunnelBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const validBannerBidRes = {
width: 300
};

const invalidBannerBidRes = '';

const validVideoBidReq = {
bidder: BIDDER_CODE,
params: {
Expand Down Expand Up @@ -162,6 +164,24 @@ describe('ucfunnel Adapter', function () {
});
});

describe('handle banner no ad', function () {
const request = spec.buildRequests([ validBannerBidReq ]);
const result = spec.interpretResponse({body: invalidBannerBidRes}, request[0]);
it('should build bid array for banner', function () {
expect(result.length).to.equal(1);
});

it('should have all relevant fields', function () {
const bid = result[0];

expect(bid.ad).to.exist;
expect(bid.requestId).to.equal('263be71e91dd9d');
expect(bid.cpm).to.equal(0);
expect(bid.width).to.equal(300);
expect(bid.height).to.equal(250);
});
});

describe('should support video', function () {
const request = spec.buildRequests([ validVideoBidReq ]);
const result = spec.interpretResponse({body: validVideoBidRes}, request[0]);
Expand Down

0 comments on commit 388cd71

Please sign in to comment.