Skip to content

Commit

Permalink
try fix appnexus case
Browse files Browse the repository at this point in the history
  • Loading branch information
peczenyj committed May 26, 2023
1 parent e2c5747 commit 919540a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
3 changes: 2 additions & 1 deletion modules/weboramaRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,10 @@ class WeboramaRtdProvider {
*/
// eslint-disable-next-line no-dupe-class-members
#handleAppnexusBid(reqBidsConfigObj, bid, profile, metadata) {
this.#assignProfileToObject(bid, 'params.keywords', profile);
if (metadata.user) {
this.#setBidderOrtb2(reqBidsConfigObj.ortb2Fragments?.bidder, bid.bidder, 'user.keywords', profile);
} else {
this.#assignProfileToObject(bid, 'params.keywords', profile);
}
}

Expand Down
16 changes: 6 additions & 10 deletions test/spec/modules/weboramaRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids.length).to.equal(5);
expect(reqBidsConfigObj.adUnits[0].bids[0].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(data);
expect(reqBidsConfigObj.adUnits[0].bids[2].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.be.undefined;
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
Expand Down Expand Up @@ -1585,7 +1585,7 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids.length).to.equal(5);
expect(adUnit.bids[0].params).to.be.undefined;
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[2].params.keywords).to.deep.equal(data);
expect(adUnit.bids[2].params).to.be.undefined;
expect(adUnit.bids[3].params).to.be.undefined;
});
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
Expand Down Expand Up @@ -1712,6 +1712,7 @@ describe('weboramaRtdProvider', function() {
expect(adUnit.bids.length).to.equal(5);
expect(adUnit.bids[0].params).to.be.undefined;
expect(adUnit.bids[1].params).to.be.undefined;
expect(adUnit.bids[2].params).to.be.undefined;
expect(adUnit.bids[3].params).to.be.undefined;
});
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
Expand All @@ -1731,9 +1732,6 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.ortb2Fragments.bidder[v]).to.be.undefined;
})

expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(data);
expect(reqBidsConfigObj.adUnits[1].bids[2].params).to.be.undefined;

expect(onDataResponse).to.deep.equal({
data: data,
meta: {
Expand Down Expand Up @@ -2189,8 +2187,6 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids[1].params.dctr).to.equal('foo=bar');
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal({
foo: ['bar'],
webo_cs: ['foo', 'bar'],
webo_audiences: ['baz'],
});
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.deep.equal({
inventory: {
Expand Down Expand Up @@ -2278,7 +2274,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids.length).to.equal(5);
expect(reqBidsConfigObj.adUnits[0].bids[0].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(defaultProfile);
expect(reqBidsConfigObj.adUnits[0].bids[2].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.be.undefined;
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
Expand Down Expand Up @@ -2365,7 +2361,7 @@ describe('weboramaRtdProvider', function() {
expect(reqBidsConfigObj.adUnits[0].bids.length).to.equal(5);
expect(reqBidsConfigObj.adUnits[0].bids[0].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[2].params.keywords).to.deep.equal(defaultProfile);
expect(reqBidsConfigObj.adUnits[0].bids[2].params).to.be.undefined;
expect(reqBidsConfigObj.adUnits[0].bids[3].params).to.be.undefined;
['smartadserver', 'pubmatic', 'appnexus', 'rubicon', 'other'].forEach((v) => {
if (v == 'appnexus') {
Expand Down Expand Up @@ -2653,7 +2649,7 @@ describe('weboramaRtdProvider', function() {

Object.keys(testcases).forEach(label => {
const sendToBidders = testcases[label];
it(`check sendToBidders as ${label}`, function() {
it(`check sendToBidders as '${label}'`, function() {
let onDataResponse = {};
const moduleConfig = {
params: {
Expand Down

0 comments on commit 919540a

Please sign in to comment.