Skip to content
Closed
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
2 changes: 1 addition & 1 deletion modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export const spec = {
const bidResponses = [];
let response = serverResponse.body;
try {
if (response && !response.isNoAd) {
if (response && !response.isNoAd && (response.ad || response.adUrl)) {
const bidRequest = JSON.parse(bidRequestString.data);

let bidResponse = {
Expand Down
26 changes: 21 additions & 5 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,27 @@ describe('Smart bid adapter tests', function () {
}).to.not.throw();
});

it('Should not nest response if ad and adUrl empty', () => {
const BID_RESPONSE_EMPTY = {
body: {
ad: null,
adUrl: null,
cpm: 0.92,
isNoAd: false
}
};

const request = spec.buildRequests(DEFAULT_PARAMS);
const bids = spec.interpretResponse(BID_RESPONSE_EMPTY, request[0]);

expect(bids).to.have.lengthOf(0);
expect(() => {
spec.interpretResponse(BID_RESPONSE_EMPTY, {
data: 'invalid Json'
});
}).to.not.throw();
});

it('Verify parse response', function () {
const request = spec.buildRequests(DEFAULT_PARAMS);
const bids = spec.interpretResponse(BID_RESPONSE, request[0]);
Expand Down Expand Up @@ -338,7 +359,6 @@ describe('Smart bid adapter tests', function () {
describe('gdpr tests', function () {
afterEach(function () {
config.resetConfig();
$$PREBID_GLOBAL$$.requestBids.removeAll();
});

it('Verify build request with GDPR', function () {
Expand Down Expand Up @@ -390,7 +410,6 @@ describe('Smart bid adapter tests', function () {
describe('ccpa/us privacy tests', function () {
afterEach(function () {
config.resetConfig();
$$PREBID_GLOBAL$$.requestBids.removeAll();
});

it('Verify build request with us privacy', function () {
Expand Down Expand Up @@ -419,7 +438,6 @@ describe('Smart bid adapter tests', function () {
describe('Instream video tests', function () {
afterEach(function () {
config.resetConfig();
$$PREBID_GLOBAL$$.requestBids.removeAll();
});

const INSTREAM_DEFAULT_PARAMS = [{
Expand Down Expand Up @@ -678,7 +696,6 @@ describe('Smart bid adapter tests', function () {
describe('Outstream video tests', function () {
afterEach(function () {
config.resetConfig();
$$PREBID_GLOBAL$$.requestBids.removeAll();
});

const OUTSTREAM_DEFAULT_PARAMS = [{
Expand Down Expand Up @@ -1019,7 +1036,6 @@ describe('Smart bid adapter tests', function () {
describe('Verify bid requests with multiple mediaTypes', function () {
afterEach(function () {
config.resetConfig();
$$PREBID_GLOBAL$$.requestBids.removeAll();
});

var DEFAULT_PARAMS_MULTIPLE_MEDIA_TYPES = [{
Expand Down