From 9eaf6e522a13b4f016fdc68bb8e5a47f2e751b9d Mon Sep 17 00:00:00 2001 From: Olivier Date: Tue, 14 Jan 2020 01:57:40 +0100 Subject: [PATCH] AdagioBidAdapter: cast organizationId param as a string (#4721) * AdagioBidAdapter: cast organizationId param as a string * AdagioBidAdapter: Fix tests --- modules/adagioBidAdapter.js | 3 +++ test/spec/modules/adagioBidAdapter_spec.js | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/adagioBidAdapter.js b/modules/adagioBidAdapter.js index d9b147fe26f..4e237584389 100644 --- a/modules/adagioBidAdapter.js +++ b/modules/adagioBidAdapter.js @@ -394,6 +394,9 @@ export const spec = { // Regroug ad units by siteId const groupedAdUnits = adUnits.reduce((groupedAdUnits, adUnit) => { + if (adUnit.params && adUnit.params.organizationId) { + adUnit.params.organizationId = adUnit.params.organizationId.toString(); + } (groupedAdUnits[adUnit.params.organizationId] = groupedAdUnits[adUnit.params.organizationId] || []).push(adUnit); return groupedAdUnits; }, {}); diff --git a/test/spec/modules/adagioBidAdapter_spec.js b/test/spec/modules/adagioBidAdapter_spec.js index 1445c09bbbe..3ba1a24eaaf 100644 --- a/test/spec/modules/adagioBidAdapter_spec.js +++ b/test/spec/modules/adagioBidAdapter_spec.js @@ -414,7 +414,16 @@ describe('adagioAdapter', () => { const requests = spec.buildRequests([bidRequests[0]], bidderRequest); const request = requests[0]; expect(request.data.adUnits[0].features.print_number).to.equal('2'); - }) + }); + + it('organizationId param key must be a string', () => { + const requests = spec.buildRequests([Object.assign({}, bidRequests[0], {params: {organizationId: 1010}})], bidderRequest); + const request = requests[0]; + expect(request.data.adUnits[0].params).to.exist; + expect(request.data.adUnits[0].params.organizationId).to.deep.equal('1010'); + expect(request.data.organizationId).to.exist; + expect(request.data.organizationId).to.deep.equal('1010'); + }); it('GDPR consent is applied', () => { const requests = spec.buildRequests(bidRequests, bidderRequest);