Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeta Global SSP Bid Adapter: change shortname to no longer be a required parameter #10597

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions modules/zeta_global_sspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const spec = {
supportedMediaTypes: [BANNER, VIDEO],

/**
* Determines whether or not the given bid request is valid.
* Determines whether the given bid request is valid.
*
* @param {BidRequest} bid The bid params to validate.
* @return boolean True if this is a valid bid, and false otherwise.
Expand All @@ -54,7 +54,8 @@ export const spec = {
// check for all required bid fields
if (!(bid &&
bid.bidId &&
bid.params)) {
bid.params &&
bid.params.sid)) {
logWarn('Invalid bid request - missing required bid data');
return false;
}
Expand Down Expand Up @@ -162,7 +163,7 @@ export const spec = {
}

provideEids(validBidRequests[0], payload);
const url = params.shortname ? ENDPOINT_URL.concat('?shortname=', params.shortname) : ENDPOINT_URL;
const url = params.sid ? ENDPOINT_URL.concat('?sid=', params.sid) : ENDPOINT_URL;
return {
method: 'POST',
url: url,
Expand Down
18 changes: 10 additions & 8 deletions test/spec/modules/zeta_global_sspBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {spec} from '../../../modules/zeta_global_sspBidAdapter.js'
import {BANNER, VIDEO} from '../../../src/mediaTypes';
import {deepClone} from '../../../src/utils';

describe('Zeta Ssp Bid Adapter', function () {
const eids = [
Expand Down Expand Up @@ -50,7 +51,6 @@ describe('Zeta Ssp Bid Adapter', function () {
someTag: 444,
},
sid: 'publisherId',
shortname: 'test_shortname',
tagid: 'test_tag_id',
site: {
page: 'testPage'
Expand Down Expand Up @@ -253,11 +253,13 @@ describe('Zeta Ssp Bid Adapter', function () {
};

it('Test the bid validation function', function () {
const validBid = spec.isBidRequestValid(bannerRequest[0]);
const invalidBid = spec.isBidRequestValid(null);
const invalidBid = deepClone(bannerRequest[0]);
invalidBid.params = {};
const isValidBid = spec.isBidRequestValid(bannerRequest[0]);
const isInvalidBid = spec.isBidRequestValid(null);

expect(validBid).to.be.true;
expect(invalidBid).to.be.false;
expect(isValidBid).to.be.true;
expect(isInvalidBid).to.be.false;
});

it('Test provide eids', function () {
Expand Down Expand Up @@ -453,7 +455,7 @@ describe('Zeta Ssp Bid Adapter', function () {
it('Test required params in banner request', function () {
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
const payload = JSON.parse(request.data);
expect(request.url).to.eql('https://ssp.disqus.com/bid/prebid?shortname=test_shortname');
expect(request.url).to.eql('https://ssp.disqus.com/bid/prebid?sid=publisherId');
expect(payload.ext.sid).to.eql('publisherId');
expect(payload.ext.tags.someTag).to.eql(444);
expect(payload.ext.tags.shortname).to.be.undefined;
Expand All @@ -462,7 +464,7 @@ describe('Zeta Ssp Bid Adapter', function () {
it('Test required params in video request', function () {
const request = spec.buildRequests(videoRequest, videoRequest[0]);
const payload = JSON.parse(request.data);
expect(request.url).to.eql('https://ssp.disqus.com/bid/prebid?shortname=test_shortname');
expect(request.url).to.eql('https://ssp.disqus.com/bid/prebid?sid=publisherId');
expect(payload.ext.sid).to.eql('publisherId');
expect(payload.ext.tags.someTag).to.eql(444);
expect(payload.ext.tags.shortname).to.be.undefined;
Expand All @@ -471,7 +473,7 @@ describe('Zeta Ssp Bid Adapter', function () {
it('Test multi imp', function () {
const request = spec.buildRequests(multiImpRequest, multiImpRequest[0]);
const payload = JSON.parse(request.data);
expect(request.url).to.eql('https://ssp.disqus.com/bid/prebid?shortname=test_shortname');
expect(request.url).to.eql('https://ssp.disqus.com/bid/prebid?sid=publisherId');

expect(payload.imp.length).to.eql(2);

Expand Down