Skip to content

Commit

Permalink
Yahoo SSP Bid Adapter: interstitial fix (prebid#7746)
Browse files Browse the repository at this point in the history
* ortb2Imp.instl

* ortb2Imp.instl unit-test

* numeric boolean validations

* refacotor for false 0

* tests stable
  • Loading branch information
adam-browning authored and Chris Pabst committed Jan 10, 2022
1 parent 671fd67 commit 0855170
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
6 changes: 5 additions & 1 deletion modules/yahoosspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Renderer } from '../src/Renderer.js';

const INTEGRATION_METHOD = 'prebid.js';
const BIDDER_CODE = 'yahoossp';
const ADAPTER_VERSION = '1.0.1';
const ADAPTER_VERSION = '1.0.2';
const PREBID_VERSION = '$prebid.version$';
const DEFAULT_BID_TTL = 300;
const TEST_MODE_DCN = '8a969516017a7a396ec539d97f540011';
Expand Down Expand Up @@ -359,6 +359,10 @@ function appendImpObject(bid, openRtbObject) {
impObject.ext.data = bid.ortb2Imp.ext.data;
};

if (deepAccess(bid, 'ortb2Imp.instl') && isNumber(bid.ortb2Imp.instl) && (bid.ortb2Imp.instl === 1)) {
impObject.instl = bid.ortb2Imp.instl;
};

if (getPubIdMode(bid) === false) {
impObject.tagid = bid.params.pos;
impObject.ext.pos = bid.params.pos;
Expand Down
29 changes: 28 additions & 1 deletion test/spec/modules/yahoosspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_AD_UNIT_CODE = '/19968336/header-bid-tag-1';
const DEFAULT_AD_UNIT_TYPE = 'banner';
const DEFAULT_PARAMS_BID_OVERRIDE = {};
const DEFAULT_VIDEO_CONTEXT = 'instream';
const ADAPTER_VERSION = '1.0.1';
const ADAPTER_VERSION = '1.0.2';
const PREBID_VERSION = '$prebid.version$';
const INTEGRATION_METHOD = 'prebid.js';

Expand Down Expand Up @@ -656,6 +656,33 @@ describe('YahooSSP Bid Adapter:', () => {
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].ext.data).to.deep.equal(validBidRequests[0].ortb2Imp.ext.data);
});
// adUnit.ortb2Imp.instl
it(`should allow adUnit.ortb2Imp.instl numeric boolean "1" to be added to the bid-request`, () => {
let { validBidRequests, bidderRequest } = generateBuildRequestMock({})
validBidRequests[0].ortb2Imp = {
instl: 1
};
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].instl).to.deep.equal(validBidRequests[0].ortb2Imp.instl);
});

it(`should prevent adUnit.ortb2Imp.instl boolean "true" to be added to the bid-request`, () => {
let { validBidRequests, bidderRequest } = generateBuildRequestMock({})
validBidRequests[0].ortb2Imp = {
instl: true
};
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].instl).to.not.exist;
});

it(`should prevent adUnit.ortb2Imp.instl boolean "false" to be added to the bid-request`, () => {
let { validBidRequests, bidderRequest } = generateBuildRequestMock({})
validBidRequests[0].ortb2Imp = {
instl: false
};
const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
expect(data.imp[0].instl).to.not.exist;
});
});

describe('e2etest mode support:', () => {
Expand Down

0 comments on commit 0855170

Please sign in to comment.