From 870bdd5a6612d469dd42ac1e13dcfbd8d78c30a8 Mon Sep 17 00:00:00 2001 From: El Mahfoudi Saad Date: Tue, 5 Dec 2023 09:46:32 +0100 Subject: [PATCH] fixup! Add new window features to HB request --- modules/teadsBidAdapter.js | 2 +- test/spec/modules/teadsBidAdapter_spec.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/teadsBidAdapter.js b/modules/teadsBidAdapter.js index ba16c6ddf82b..9a53207c5cf9 100644 --- a/modules/teadsBidAdapter.js +++ b/modules/teadsBidAdapter.js @@ -61,7 +61,7 @@ export const spec = { viewportHeight: topWindow.visualViewport?.height, viewportWidth: topWindow.visualViewport?.width, hardwareConcurrency: topWindow.navigator?.hardwareConcurrency, - deviceMemory: topWindow.navigator?.deviceMemory, + deviceMemory: topWindow.navigator?.deviceMemory.toString() || '', hb_version: '$prebid.version$', ...getSharedViewerIdParameters(validBidRequests), ...getFirstPartyTeadsIdParameter(validBidRequests) diff --git a/test/spec/modules/teadsBidAdapter_spec.js b/test/spec/modules/teadsBidAdapter_spec.js index 4c5bcdcfa316..ab79cfd7ba54 100644 --- a/test/spec/modules/teadsBidAdapter_spec.js +++ b/test/spec/modules/teadsBidAdapter_spec.js @@ -297,9 +297,12 @@ describe('teadsBidAdapter', () => { it('should add deviceMemory info to payload', function () { const request = spec.buildRequests(bidRequests, bidderRequestDefault); const payload = JSON.parse(request.data); + const deviceMemory = window.top.navigator?.deviceMemory expect(payload.deviceMemory).to.exist; - expect(payload.deviceMemory).to.deep.equal(window.top.navigator.deviceMemory); + if (deviceMemory) { + expect(payload.deviceMemory).to.deep.equal(deviceMemory.toString()); + } else expect(payload.deviceMemory).to.deep.equal('') }); describe('pageTitle', function () {