Skip to content

Commit

Permalink
Medianet Bid Adapter: added AAX bidder alias (prebid#9095)
Browse files Browse the repository at this point in the history
* added aax bidder alias

* added test for aax alias

Co-authored-by: adish <adish.r@media.net>
  • Loading branch information
2 people authored and jorgeluisrocha committed May 18, 2023
1 parent 24fe95a commit e104f88
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/medianetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ mnData.urlData = {
isTop: refererInfo.reachedTop
};

const aliases = [
{ code: 'aax', gvlid: 720 },
];

$$PREBID_GLOBAL$$.medianetGlobals = $$PREBID_GLOBAL$$.medianetGlobals || {};

function getTopWindowReferrer() {
Expand Down Expand Up @@ -418,7 +422,7 @@ export const spec = {

code: BIDDER_CODE,
gvlid: 142,

aliases,
supportedMediaTypes: [BANNER, NATIVE, VIDEO],

/**
Expand Down
76 changes: 76 additions & 0 deletions test/spec/modules/medianetBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,25 +856,50 @@ let VALID_BID_REQUEST = [{
cid: '8CUV090'
}
},
VALID_PARAMS_AAX = {
bidder: 'aax',
params: {
cid: 'AAXG123'
}
},
PARAMS_MISSING = {
bidder: 'medianet',
},
PARAMS_MISSING_AAX = {
bidder: 'aax',
},
PARAMS_WITHOUT_CID = {
bidder: 'medianet',
params: {}
},
PARAMS_WITHOUT_CID_AAX = {
bidder: 'aax',
params: {}
},
PARAMS_WITH_INTEGER_CID = {
bidder: 'medianet',
params: {
cid: 8867587
}
},
PARAMS_WITH_INTEGER_CID_AAX = {
bidder: 'aax',
params: {
cid: 8867587
}
},
PARAMS_WITH_EMPTY_CID = {
bidder: 'medianet',
params: {
cid: ''
}
},
PARAMS_WITH_EMPTY_CID_AAX = {
bidder: 'aax',
params: {
cid: ''
}
},
SYNC_OPTIONS_BOTH_ENABLED = {
iframeEnabled: true,
pixelEnabled: true,
Expand Down Expand Up @@ -1571,4 +1596,55 @@ describe('Media.net bid adapter', function () {
expect(requestObj.imp[0].hasOwnProperty('bidfloors')).to.equal(true);
});
});

describe('isBidRequestValid aax', function () {
it('should accept valid bid params', function () {
let isValid = spec.isBidRequestValid(VALID_PARAMS_AAX);
expect(isValid).to.equal(true);
});

it('should reject bid if cid is not present', function () {
let isValid = spec.isBidRequestValid(PARAMS_WITHOUT_CID_AAX);
expect(isValid).to.equal(false);
});

it('should reject bid if cid is not a string', function () {
let isValid = spec.isBidRequestValid(PARAMS_WITH_INTEGER_CID_AAX);
expect(isValid).to.equal(false);
});

it('should reject bid if cid is a empty string', function () {
let isValid = spec.isBidRequestValid(PARAMS_WITH_EMPTY_CID_AAX);
expect(isValid).to.equal(false);
});

it('should have missing params', function () {
let isValid = spec.isBidRequestValid(PARAMS_MISSING_AAX);
expect(isValid).to.equal(false);
});
});

describe('interpretResponse aax', function () {
it('should not push response if no-bid', function () {
let validBids = [];
let bids = spec.interpretResponse(SERVER_RESPONSE_NOBID, []);
expect(bids).to.deep.equal(validBids);
});

it('should have empty bid response', function() {
let bids = spec.interpretResponse(SERVER_RESPONSE_NOBODY, []);
expect(bids).to.deep.equal([]);
});

it('should have valid bids', function () {
let bids = spec.interpretResponse(SERVER_RESPONSE_VALID_BID, []);
expect(bids).to.deep.equal(SERVER_VALID_BIDS);
});

it('should have empty bid list', function() {
let validBids = [];
let bids = spec.interpretResponse(SERVER_RESPONSE_EMPTY_BIDLIST, []);
expect(bids).to.deep.equal(validBids);
});
});
});

0 comments on commit e104f88

Please sign in to comment.