From fb34ffe5d67107c39576524023b30924ef52c8c9 Mon Sep 17 00:00:00 2001 From: "masaki.shinke" Date: Mon, 7 Feb 2022 18:17:21 +0900 Subject: [PATCH] add bidder fluct --- modules/imRtdProvider.js | 10 ++++++++ test/spec/modules/imRtdProvider_spec.js | 31 ++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/modules/imRtdProvider.js b/modules/imRtdProvider.js index 7ab19c0e2d6..6c582df3df3 100644 --- a/modules/imRtdProvider.js +++ b/modules/imRtdProvider.js @@ -60,6 +60,16 @@ export function getBidderFunction(bidderName) { ); } return bid + }, + fluct: function (bid, data) { + if (data.im_segments && data.im_segments.length) { + deepSetValue( + bid, + 'params.kv.imsids', + data.im_segments + ); + } + return bid } } return biddersFunction[bidderName] || null; diff --git a/test/spec/modules/imRtdProvider_spec.js b/test/spec/modules/imRtdProvider_spec.js index e3365e8eaf2..6d92440a144 100644 --- a/test/spec/modules/imRtdProvider_spec.js +++ b/test/spec/modules/imRtdProvider_spec.js @@ -51,7 +51,8 @@ describe('imRtdProvider', function () { describe('getBidderFunction', function () { const assumedBidder = [ 'ix', - 'pubmatic' + 'pubmatic', + 'fluct' ]; assumedBidder.forEach(bidderName => { it(`should return bidderFunction with assumed bidder: ${bidderName}`, function () { @@ -70,6 +71,34 @@ describe('imRtdProvider', function () { it(`should return null with unexpected bidder`, function () { expect(getBidderFunction('test')).to.equal(null); }); + describe('fluct bidder function', function () { + it('should return a bid w/o im_segments if not any exists', function () { + const bid = {bidder: 'fluct'}; + expect(getBidderFunction('fluct')(bid, '')).to.eql(bid); + }); + it('should return a bid w/ im_segments if any exists', function () { + const bid = { + bidder: 'fluct', + params: { + kv: { + foo: ['foo1'] + } + } + }; + expect(getBidderFunction('fluct')(bid, {im_segments: ['12345', '67890']})) + .to.eql( + { + bidder: 'fluct', + params: { + kv: { + foo: ['foo1'], + imsids: ['12345', '67890'] + } + } + } + ); + }); + }); }) describe('getCustomBidderFunction', function () {