Skip to content

Updated test cases #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/spec/modules/BTBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'modules/consentManagementUsp.js';
import 'modules/consentManagementGpp.js';
import 'modules/tcfControl.js';
import 'modules/gppControl_usnat.js';
import 'modules/schain.js';

describe('BT Bid Adapter', () => {
const ENDPOINT_URL = 'https://pbs.btloader.com/openrtb2/auction';
Expand Down
1 change: 0 additions & 1 deletion test/spec/modules/blastoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'modules/multibid/index.js';
import 'modules/priceFloors.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/schain.js';

const SIMPLE_BID_REQUEST = {
bidder: 'blasto',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/bridgeuppBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ describe('bridgeuppBidAdapter_spec', function () {
},
];
const ortbRequest = spec.buildRequests(bidRequests, await addFPDToBidderRequest({...bidderRequest, ortb2})).data;
expect(ortbRequest.source.schain).to.deep.equal(expectedSchain);
expect(ortbRequest.source.ext.schain).to.deep.equal(expectedSchain);
expect(ortbRequest.source.pchain).to.equal('sonarads');
});

Expand Down
15 changes: 13 additions & 2 deletions test/spec/modules/conversantBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'modules/userId/index.js'; // handles eids
import 'modules/priceFloors.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/schain.js'; // handles schain
import {hook} from '../../../src/hook.js'
import {BANNER} from '../../../src/mediaTypes';

Expand Down Expand Up @@ -451,9 +450,21 @@ describe('Conversant adapter tests', function() {
it('Verify supply chain data', () => {
const bidderRequest = {refererInfo: {page: 'http://test.com?a=b&c=123'}};
const schain = {complete: 1, ver: '1.0', nodes: [{asi: 'bidderA.com', sid: '00001', hp: 1}]};

// Add schain to bidderRequest
bidderRequest.ortb2 = {
source: {
ext: {schain: schain}
}
};

const bidsWithSchain = bidRequests.map((bid) => {
return Object.assign({
ortb2: {source: {schain: schain}}
ortb2: {
source: {
ext: {schain: schain}
}
}
}, bid);
});
const request = spec.buildRequests(bidsWithSchain, bidderRequest);
Expand Down
24 changes: 19 additions & 5 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'modules/userId/index.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/consentManagementGpp.js';
import 'modules/schain.js';

import {hook} from '../../../src/hook';

describe('The Criteo bidding adapter', function () {
Expand Down Expand Up @@ -1219,14 +1219,18 @@ describe('The Criteo bidding adapter', function () {
expect(ortbRequest.regs.ext.dsa).to.deep.equal(dsa);
});

it('should properly build a request with schain object', async function () {
it('should properly build a request with schain object', function () {
const expectedSchain = {
someProperty: 'someValue'
};
const bidRequests = [
{
bidder: 'criteo',
ortb2: {source: {schain: expectedSchain}},
ortb2: {
source: {
ext: {schain: expectedSchain}
}
},
adUnitCode: 'bid-123',
mediaTypes: {
banner: {
Expand All @@ -1238,9 +1242,19 @@ describe('The Criteo bidding adapter', function () {
},
},
];

// Create a modified bidderRequest with schain
const modifiedBidderRequest = {
...bidderRequest,
ortb2: {
source: {
ext: {schain: expectedSchain}
}
}
};

const ortbRequest = spec.buildRequests(bidRequests, await addFPDToBidderRequest(bidderRequest)).data;
expect(ortbRequest.source.ext.schain).to.equal(expectedSchain);
const ortbRequest = spec.buildRequests(bidRequests, modifiedBidderRequest).data;
expect(ortbRequest.source.ext.schain).to.deep.equal(expectedSchain);
});

it('should properly build a request with bcat field', async function () {
Expand Down
1 change: 0 additions & 1 deletion test/spec/modules/escalaxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'modules/multibid/index.js';
import 'modules/priceFloors.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/schain.js';

const SIMPLE_BID_REQUEST = {
bidder: 'escalax',
Expand Down
22 changes: 19 additions & 3 deletions test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'modules/multibid/index.js';
import 'modules/priceFloors.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/schain.js';
import {decorateAdUnitsWithNativeParams} from '../../../src/native.js';
import {hook} from '../../../src/hook.js';
import {addFPDToBidderRequest} from '../../helpers/fpd.js';
Expand Down Expand Up @@ -553,8 +552,25 @@ describe('Improve Digital Adapter Tests', function () {
it('should add schain', function () {
const schain = '{"ver":"1.0","complete":1,"nodes":[{"asi":"headerlift.com","sid":"xyz","hp":1}]}';
const bidRequest = Object.assign({}, simpleBidRequest);
bidRequest.ortb2 = {source: {schain: schain}};
const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];

// Add schain to both locations in the bid
bidRequest.ortb2 = {
source: {
ext: {schain: schain}
}
};

// Add schain to bidderRequest as well
const modifiedBidderRequest = {
...bidderRequestReferrer,
ortb2: {
source: {
ext: {schain: schain}
}
}
};

const request = spec.buildRequests([bidRequest], modifiedBidderRequest)[0];
const payload = JSON.parse(request.data);
expect(payload.source.ext.schain).to.equal(schain);
});
Expand Down
16 changes: 13 additions & 3 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'modules/multibid/index.js';
import 'modules/priceFloors.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/schain.js';
import 'modules/paapi.js';

import {deepClone} from 'src/utils.js';
Expand Down Expand Up @@ -1106,13 +1105,24 @@ describe('OpenxRtbAdapter', function () {
bidId: 'test-bid-id-1',
bidderRequestId: 'test-bid-request-1',
auctionId: 'test-auction-1',
ortb2: {source: {schain: schainConfig}}
ortb2: {source: {
schain: schainConfig,
ext: {schain: schainConfig}
}}
}];

// Add schain to mockBidderRequest as well
mockBidderRequest.ortb2 = {
source: {
schain: schainConfig,
ext: {schain: schainConfig}
}
};
});

it('should send a supply chain object', function () {
const request = spec.buildRequests(bidRequests, mockBidderRequest);
expect(request[0].data.source.ext.schain).to.equal(schainConfig);
expect(request[0].data.source.ext.schain).to.deep.equal(schainConfig);
});

it('should send the supply chain object with the right version', function () {
Expand Down
32 changes: 27 additions & 5 deletions test/spec/modules/pulsepointBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {deepClone} from '../../../src/utils';
import 'modules/consentManagementTcf';
import 'modules/consentManagementUsp';
import 'modules/userId/index';
import 'modules/schain';

describe('PulsePoint Adapter Tests', function () {
const slotConfigs = [{
Expand Down Expand Up @@ -136,7 +135,7 @@ describe('PulsePoint Adapter Tests', function () {
bidfloor: 1.5,
badv: ['cocacola.com', 'lays.com']
},
ortb2: {source: {schain: {
ortb2: {source: {ext: {schain: {
'ver': '1.0',
'complete': 1,
'nodes': [
Expand All @@ -149,7 +148,7 @@ describe('PulsePoint Adapter Tests', function () {
'domain': 'publisher.com'
}
]
}}}
}}}}
}];

const bidderRequest = {
Expand Down Expand Up @@ -467,8 +466,31 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.imp[0].ext).to.be.undefined;
});

it('Verify schain parameters', async function () {
const request = spec.buildRequests(schainParamsSlotConfig, await addFPDToBidderRequest(bidderRequest));
it('Verify schain parameters', function () {
const modifiedBidderRequest = {
...bidderRequest,
ortb2: {
source: {
ext: {
schain: {
'ver': '1.0',
'complete': 1,
'nodes': [
{
'asi': 'exchange1.com',
'sid': '1234',
'hp': 1,
'rid': 'bid-request-1',
'name': 'publisher',
'domain': 'publisher.com'
}
]
}
}
}
}
};
const request = spec.buildRequests(schainParamsSlotConfig, modifiedBidderRequest);
const ortbRequest = request.data;
expect(ortbRequest).to.not.equal(null);
expect(ortbRequest.source).to.not.equal(null);
Expand Down
1 change: 0 additions & 1 deletion test/spec/modules/r2b2BidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {expect} from 'chai';
import {spec, internal as r2b2, internal} from 'modules/r2b2BidAdapter.js';
import * as utils from '../../../src/utils';
import 'modules/schain.js';
import 'modules/userId/index.js';

function encodePlacementIds (ids) {
Expand Down
3 changes: 1 addition & 2 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import {config} from 'src/config.js';
import * as utils from 'src/utils.js';
import {find} from 'src/polyfill.js';
import 'modules/schain.js';
import 'modules/consentManagementTcf.js';
import 'modules/consentManagementUsp.js';
import 'modules/userId/index.js';
Expand Down Expand Up @@ -4673,7 +4672,7 @@ describe('the rubicon adapter', function () {
it('should copy the schain JSON to to bid.source.ext.schain', () => {
const bidderRequest = createVideoBidderRequest();
const schain = getSupplyChainConfig();
bidderRequest.bids[0].ortb2.source.schain = schain;
bidderRequest.bids[0].ortb2.source.ext = { schain: schain };
const request = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(request[0].data.source.ext.schain).to.deep.equal(schain);
});
Expand Down
Loading
Loading