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

Medianet Bid Adapter: added AAX bidder alias #9095

Merged
merged 2 commits into from
Oct 18, 2022
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
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);
});
});
});