Skip to content

Commit

Permalink
feat: pangle multi format (prebid#11175)
Browse files Browse the repository at this point in the history
  • Loading branch information
pangle-fe authored and mefjush committed Mar 7, 2024
1 parent ab124e7 commit 06a7eb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions modules/pangleBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ver V1.0.4
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { ortbConverter } from '../libraries/ortbConverter/converter.js'
import { registerBidder } from '../src/adapters/bidderFactory.js';
Expand Down Expand Up @@ -155,15 +154,16 @@ export const spec = {
},

buildRequests(bidRequests, bidderRequest) {
const reqArr = [];
const videoBids = bidRequests.filter((bid) => isVideoBid(bid));
const bannerBids = bidRequests.filter((bid) => isBannerBid(bid));
let requests = bannerBids.length
? [createRequest(bannerBids, bidderRequest, BANNER)]
: [];
bannerBids.forEach((bid) => {
reqArr.push(createRequest([bid], bidderRequest, BANNER));
})
videoBids.forEach((bid) => {
requests.push(createRequest([bid], bidderRequest, VIDEO));
reqArr.push(createRequest([bid], bidderRequest, VIDEO));
});
return requests;
return reqArr;
},

interpretResponse(response, request) {
Expand Down
14 changes: 9 additions & 5 deletions test/spec/modules/pangleBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,15 @@ describe('pangle bid adapter', function () {

describe('buildRequests', function () {
it('creates request data', function () {
let request = spec.buildRequests(REQUEST, DEFAULT_OPTIONS)[0];
expect(request).to.exist.and.to.be.a('object');
const payload = request.data;
expect(payload.imp[0]).to.have.property('id', REQUEST[0].bidId);
expect(payload.imp[1]).to.have.property('id', REQUEST[1].bidId);
let request1 = spec.buildRequests(REQUEST, DEFAULT_OPTIONS)[0];
expect(request1).to.exist.and.to.be.a('object');
const payload1 = request1.data;
expect(payload1.imp[0]).to.have.property('id', REQUEST[0].bidId);

let request2 = spec.buildRequests(REQUEST, DEFAULT_OPTIONS)[1];
expect(request2).to.exist.and.to.be.a('object');
const payload2 = request2.data;
expect(payload2.imp[0]).to.have.property('id', REQUEST[1].bidId);
});
});

Expand Down

0 comments on commit 06a7eb4

Please sign in to comment.