Skip to content

Commit

Permalink
added one more test for buildRequests
Browse files Browse the repository at this point in the history
  • Loading branch information
Octavia Suceava authored and Octavia Suceava committed Oct 16, 2024
1 parent 34453ff commit 6624dc1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/spec/modules/connatixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import adapterManager from '../../../src/adapterManager.js';
import * as ajax from '../../../src/ajax.js';
import { ADPOD, BANNER, VIDEO } from '../../../src/mediaTypes.js';
import { getStorageManager } from '../../../src/storageManager.js';

const BIDDER_CODE = 'connatix';

Expand Down Expand Up @@ -568,6 +567,7 @@ describe('connatixBidAdapter', function () {

describe('buildRequests', function () {
let serverRequest;
let setCookieStub, setDataInLocalStorageStub;
let bidderRequest = {
refererInfo: {
canonicalUrl: '',
Expand Down Expand Up @@ -596,10 +596,21 @@ describe('connatixBidAdapter', function () {
};

this.beforeEach(function () {
const mockIdentityProviderData = { mockKey: 'mockValue' };
const CNX_IDS_EXPIRY = 24 * 30 * 60 * 60 * 1000;
setCookieStub = sinon.stub(storage, 'setCookie');
setDataInLocalStorageStub = sinon.stub(storage, 'setDataInLocalStorage');
connatixSaveOnAllStorages('test_ids_cnx', mockIdentityProviderData, CNX_IDS_EXPIRY);

bid = mockBidRequest();
serverRequest = spec.buildRequests([bid], bidderRequest);
})

this.afterEach(function() {
setCookieStub.restore();
setDataInLocalStorageStub.restore();
});

it('Creates a ServerRequest object with method, URL and data', function () {
expect(serverRequest).to.exist;
expect(serverRequest.method).to.exist;
Expand All @@ -626,6 +637,7 @@ describe('connatixBidAdapter', function () {
expect(serverRequest.data.uspConsent).to.equal(bidderRequest.uspConsent);
expect(serverRequest.data.gppConsent).to.equal(bidderRequest.gppConsent);
expect(serverRequest.data.ortb2).to.equal(bidderRequest.ortb2);
expect(serverRequest.data.identityProviderData).to.deep.equal({ mockKey: 'mockValue' });
});
});

Expand Down

0 comments on commit 6624dc1

Please sign in to comment.