Skip to content

Commit

Permalink
Adt new alias (#6004)
Browse files Browse the repository at this point in the history
* Add new alias

* Add new aliases and fix endpoints

* lint

* Fix tests
  • Loading branch information
GeneGenie authored Dec 9, 2020
1 parent a17c234 commit 83bafc0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
16 changes: 12 additions & 4 deletions modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ const HOST_GETTERS = {
default: (function () {
let num = 0;
return function () {
return 'ghb' + subdomainSuffixes[num++ % subdomainSuffixes.length] + '.adtelligent.com'
return 'ghb' + subdomainSuffixes[num++ % subdomainSuffixes.length] + '.adtelligent.com';
}
}()),
appaloosa: function () {
return 'hb.appaloosa.media'
return 'ghb.hb.appaloosa.media';
},
onefiftytwomedia: function() {
return 'ghb.ads.152media.com';
},
mediafuse: function() {
return 'ghb.hbmp.mediafuse.com';
}

}
const getUri = function (bidderCode) {
let getter = HOST_GETTERS[bidderCode] || HOST_GETTERS['default'];
let bidderWithoutSuffix = bidderCode.split('_')[0];
let getter = HOST_GETTERS[bidderWithoutSuffix] || HOST_GETTERS['default'];
return PROTOCOL + getter() + AUCTION_PATH
}
const OUTSTREAM_SRC = 'https://player.adtelligent.com/outstream-unit/2.01/outstream.min.js';
Expand All @@ -32,7 +40,7 @@ const syncsCache = {};
export const spec = {
code: BIDDER_CODE,
gvlid: 410,
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa'],
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa', 'mediafuse'],
supportedMediaTypes: [VIDEO, BANNER],
isBidRequestValid: function (bid) {
return !!utils.deepAccess(bid, 'params.aid');
Expand Down
17 changes: 11 additions & 6 deletions test/spec/modules/adtelligentBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ const EXPECTED_ENDPOINTS = [
'https://ghb.adtelligent.com/v2/auction/'
];
const aliasEP = {
appaloosa: 'https://hb.appaloosa.media/v2/auction/'
appaloosa: 'https://ghb.hb.appaloosa.media/v2/auction/',
appaloosa_publisherSuffix: 'https://ghb.hb.appaloosa.media/v2/auction/',
onefiftytwomedia: 'https://ghb.ads.152media.com/v2/auction/',
mediafuse: 'https://ghb.hbmp.mediafuse.com/v2/auction/'
};

const DEFAULT_ADATPER_REQ = { bidderCode: 'adtelligent' };
const DISPLAY_REQUEST = {
'bidder': 'adtelligent',
'params': {
Expand Down Expand Up @@ -244,10 +249,10 @@ describe('adtelligentBidAdapter', () => {
let videoBidRequests = [VIDEO_REQUEST];
let displayBidRequests = [DISPLAY_REQUEST];
let videoAndDisplayBidRequests = [DISPLAY_REQUEST, VIDEO_REQUEST];
const displayRequest = spec.buildRequests(displayBidRequests, {});
const videoRequest = spec.buildRequests(videoBidRequests, {});
const videoAndDisplayRequests = spec.buildRequests(videoAndDisplayBidRequests, {});
const rotatingRequest = spec.buildRequests(displayBidRequests, {});
const displayRequest = spec.buildRequests(displayBidRequests, DEFAULT_ADATPER_REQ);
const videoRequest = spec.buildRequests(videoBidRequests, DEFAULT_ADATPER_REQ);
const videoAndDisplayRequests = spec.buildRequests(videoAndDisplayBidRequests, DEFAULT_ADATPER_REQ);
const rotatingRequest = spec.buildRequests(displayBidRequests, DEFAULT_ADATPER_REQ);
it('rotates endpoints', () => {
const bidReqUrls = [displayRequest[0], videoRequest[0], videoAndDisplayRequests[0], rotatingRequest[0]].map(br => br.url);
expect(bidReqUrls).to.deep.equal(EXPECTED_ENDPOINTS);
Expand Down Expand Up @@ -276,7 +281,7 @@ describe('adtelligentBidAdapter', () => {
expect(videoAndDisplayRequests.every(comparator)).to.be.true;
});
it('forms correct ADPOD request', () => {
const pbBidReqData = spec.buildRequests([ADPOD_REQUEST], {})[0].data;
const pbBidReqData = spec.buildRequests([ADPOD_REQUEST], DEFAULT_ADATPER_REQ)[0].data;
const impRequest = pbBidReqData.BidRequests[0]
expect(impRequest.AdType).to.be.equal('video');
expect(impRequest.Adpod).to.be.a('object');
Expand Down

0 comments on commit 83bafc0

Please sign in to comment.