Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sumit sharma authored and sumit sharma committed Mar 11, 2020
1 parent 2a24271 commit 7b6f97c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ describe('AppNexusAdapter', function () {
const payload = JSON.parse(request.data);

expect(payload.tags[0].ad_types).to.deep.equal(['video']);
expect(payload.hb_source).to.equal(1);
});

it('sends bid request to ENDPOINT via POST', function () {
Expand Down Expand Up @@ -417,6 +418,44 @@ describe('AppNexusAdapter', function () {
expect(payload3.tags.length).to.equal(15);
});

it('should contain hb_source value for adpod', function() {
let bidRequest = Object.assign({},
bidRequests[0],
{
params: { placementId: '14542875' }
},
{
mediaTypes: {
video: {
context: 'adpod',
playerSize: [640, 480],
adPodDurationSec: 300,
durationRangeSec: [15, 30],
}
}
}
);
const request = spec.buildRequests([bidRequest])[0];
const payload = JSON.parse(request.data);
expect(payload.hb_source).to.equal(7);
});

it('should contain hb_source value for other media', function() {
let bidRequest = Object.assign({},
bidRequests[0],
{
mediaType: 'banner',
params: {
sizes: [[300, 250], [300, 600]],
placementId: 13144370
}
}
);
const request = spec.buildRequests([bidRequest]);
const payload = JSON.parse(request.data);
expect(payload.hb_source).to.equal(1);
});

it('adds brand_category_exclusion to request when set', function() {
let bidRequest = Object.assign({}, bidRequests[0]);
sinon
Expand Down Expand Up @@ -480,6 +519,7 @@ describe('AppNexusAdapter', function () {
saleprice: {required: true},
privacy_supported: true
});
expect(payload.hb_source).to.equal(1);
});

it('should always populated tags[].sizes with 1,1 for native if otherwise not defined', function () {
Expand Down

0 comments on commit 7b6f97c

Please sign in to comment.