Skip to content

Commit

Permalink
fixup! Add new window features to HB request
Browse files Browse the repository at this point in the history
  • Loading branch information
github-saad-elmahfoudi committed Dec 6, 2023
1 parent b5afcbe commit a762537
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions test/spec/modules/teadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {expect} from 'chai';
import {spec, storage} from 'modules/teadsBidAdapter.js';
import {newBidder} from 'src/adapters/bidderFactory.js';
import { off } from '../../../src/events';

const ENDPOINT = 'https://a.teads.tv/hb/bid-request';
const AD_SCRIPT = '<script type="text/javascript" class="teads" async="true" src="https://a.teads.tv/hb/getAdSettings"></script>"';
Expand Down Expand Up @@ -257,9 +258,12 @@ describe('teadsBidAdapter', () => {
it('should add screenOrientation info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
const screenOrientation = window.top.screen.orientation?.type

expect(payload.screenOrientation).to.exist;
expect(payload.screenOrientation).to.deep.equal(window.top.screen.orientation.type);
if (screenOrientation) {
expect(payload.screenOrientation).to.exist;
expect(payload.screenOrientation).to.deep.equal(screenOrientation);
} else expect(payload.screenOrientation).to.not.exist;
});

it('should add historyLength info to payload', function () {
Expand Down Expand Up @@ -289,17 +293,23 @@ describe('teadsBidAdapter', () => {
it('should add hardwareConcurrency info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderRequestDefault);
const payload = JSON.parse(request.data);
const hardwareConcurrency = window.top.navigator?.hardwareConcurrency

expect(payload.hardwareConcurrency).to.exist;
expect(payload.hardwareConcurrency).to.deep.equal(window.top.navigator.hardwareConcurrency);
if (hardwareConcurrency) {
expect(payload.hardwareConcurrency).to.exist;
expect(payload.hardwareConcurrency).to.deep.equal(hardwareConcurrency);
} else expect(payload.hardwareConcurrency).to.not.exist
});

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.exist;
expect(payload.deviceMemory).to.deep.equal(deviceMemory);
} else expect(payload.deviceMemory).to.not.exist;
});

describe('pageTitle', function () {
Expand Down

0 comments on commit a762537

Please sign in to comment.