diff --git a/modules/sublimeBidAdapter.js b/modules/sublimeBidAdapter.js index 41fdb72e76e7..854f58df8fe9 100644 --- a/modules/sublimeBidAdapter.js +++ b/modules/sublimeBidAdapter.js @@ -9,7 +9,7 @@ const DEFAULT_CURRENCY = 'EUR'; const DEFAULT_PROTOCOL = 'https'; const DEFAULT_TTL = 600; const SUBLIME_ANTENNA = 'antenna.ayads.co'; -const SUBLIME_VERSION = '0.7.1'; +const SUBLIME_VERSION = '0.7.2'; /** * Identify the current device type @@ -207,6 +207,12 @@ function interpretResponse(serverResponse, bidRequest) { sspname: response.sspname || null }; + // We don't support advertiserDomains atm + if (response.advertiserDomains) { + // Creating a stub for Prebid.js 5.0 compliance + bidResponse.meta = Object.assign({}, bidResponse.meta, { advertiserDomains: [] }); + } + bidResponses.push(bidResponse); } diff --git a/test/spec/modules/sublimeBidAdapter_spec.js b/test/spec/modules/sublimeBidAdapter_spec.js index 2e1d65f05339..fab487cb65f0 100644 --- a/test/spec/modules/sublimeBidAdapter_spec.js +++ b/test/spec/modules/sublimeBidAdapter_spec.js @@ -47,7 +47,7 @@ describe('Sublime Adapter', function() { }); describe('isBidRequestValid', function() { - let bid = { + const bid = { bidder: 'sublime', params: { zoneId: 24549, @@ -60,14 +60,14 @@ describe('Sublime Adapter', function() { }); it('should return false when required params are not passed', function() { - let bid = Object.assign({}, bid); + const bid = Object.assign({}, bid); bid.params = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); }); }); describe('buildRequests', function() { - let bidRequests = [ + const bidRequests = [ { bidder: 'sublime', adUnitCode: 'sublime_code', @@ -90,7 +90,7 @@ describe('Sublime Adapter', function() { } ]; - let bidderRequest = { + const bidderRequest = { gdprConsent: { consentString: 'EOHEIRCOUCOUIEHZIOEIU-TEST', gdprApplies: true @@ -101,7 +101,7 @@ describe('Sublime Adapter', function() { } }; - let request = spec.buildRequests(bidRequests, bidderRequest); + const request = spec.buildRequests(bidRequests, bidderRequest); it('should have a post method', function() { expect(request[0].method).to.equal('POST'); @@ -121,7 +121,7 @@ describe('Sublime Adapter', function() { }); describe('buildRequests: default arguments', function() { - let bidRequests = [{ + const bidRequests = [{ bidder: 'sublime', adUnitCode: 'sublime_code', bidId: 'abc1234', @@ -132,7 +132,7 @@ describe('Sublime Adapter', function() { } }]; - let request = spec.buildRequests(bidRequests); + const request = spec.buildRequests(bidRequests); it('should have an url that match the default endpoint', function() { expect(request[0].url).to.equal('https://pbjs.sskzlabs.com/bid'); @@ -140,7 +140,7 @@ describe('Sublime Adapter', function() { }); describe('interpretResponse', function() { - let serverResponse = { + const serverResponse = { 'request_id': '3db3773286ee59', 'sspname': 'foo', 'cpm': 0.5, @@ -155,7 +155,7 @@ describe('Sublime Adapter', function() { } }; - let expectedResponse = [ + const expectedResponse = [ { requestId: '', cpm: 0.5, @@ -167,23 +167,23 @@ describe('Sublime Adapter', function() { sspname: 'foo', netRevenue: true, ttl: 600, - pbav: '0.7.1', + pbav: '0.7.2', ad: '', }, ]; - let result = spec.interpretResponse({body: serverResponse}); + const result = spec.interpretResponse({body: serverResponse}); expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0])); }); it('should get correct default size for 1x1', function() { - let serverResponse = { + const serverResponse = { 'requestId': 'xyz654_2', 'sspname': 'sublime', 'cpm': 0.5, 'ad': '', }; - let bidRequest = { + const bidRequest = { bidder: 'sublime', adUnitCode: 'sublime_code_2', bidId: 'abc1234_2', @@ -197,9 +197,9 @@ describe('Sublime Adapter', function() { } }; - let result = spec.interpretResponse({body: serverResponse}, bidRequest); + const result = spec.interpretResponse({body: serverResponse}, bidRequest); - let expectedResponse = { + const expectedResponse = { requestId: 'xyz654_2', cpm: 0.5, width: 1, @@ -210,7 +210,7 @@ describe('Sublime Adapter', function() { netRevenue: true, ttl: 600, ad: '', - pbav: '0.7.1', + pbav: '0.7.2', sspname: 'sublime' }; @@ -218,24 +218,24 @@ describe('Sublime Adapter', function() { }); it('should return bid empty response', function () { - let serverResponse = ''; - let bidRequest = {}; + const serverResponse = ''; + const bidRequest = {}; - let result = spec.interpretResponse({ body: serverResponse }, bidRequest); + const result = spec.interpretResponse({ body: serverResponse }, bidRequest); - let expectedResponse = []; + const expectedResponse = []; expect(result).to.deep.equal(expectedResponse); }); it('should return bid with default value in response', function () { - let serverResponse = { + const serverResponse = { 'requestId': 'xyz654_2', 'sspname': 'sublime', 'ad': '', }; - let bidRequest = { + const bidRequest = { bidder: 'sublime', adUnitCode: 'sublime_code_2', bidId: 'abc1234_2', @@ -249,9 +249,9 @@ describe('Sublime Adapter', function() { } }; - let result = spec.interpretResponse({ body: serverResponse }, bidRequest); + const result = spec.interpretResponse({ body: serverResponse }, bidRequest); - let expectedResponse = { + const expectedResponse = { requestId: 'xyz654_2', cpm: 0, width: 1, @@ -263,20 +263,20 @@ describe('Sublime Adapter', function() { netRevenue: true, ttl: 600, ad: '', - pbav: '0.7.1', + pbav: '0.7.2', }; expect(result[0]).to.deep.equal(expectedResponse); }); it('should return empty bid response because of timeout', function () { - let serverResponse = { + const serverResponse = { 'requestId': 'xyz654_2', 'timeout': true, 'ad': '', }; - let bidRequest = { + const bidRequest = { bidder: 'sublime', adUnitCode: 'sublime_code_2', bidId: 'abc1234_2', @@ -290,9 +290,9 @@ describe('Sublime Adapter', function() { } }; - let result = spec.interpretResponse({ body: serverResponse }, bidRequest); + const result = spec.interpretResponse({ body: serverResponse }, bidRequest); - let expectedResponse = []; + const expectedResponse = []; expect(result).to.deep.equal(expectedResponse); @@ -300,11 +300,28 @@ describe('Sublime Adapter', function() { spec.onTimeout(result); }); }); + + it('should add advertiserDomains', function() { + const responseWithAdvertiserDomains = utils.deepClone(serverResponse); + responseWithAdvertiserDomains.advertiserDomains = ['a_sublime_adomain']; + + const bidRequest = { + bidder: 'sublime', + params: { + zoneId: 456, + } + }; + + const result = spec.interpretResponse({ body: responseWithAdvertiserDomains }, bidRequest); + + expect(Object.keys(result[0].meta)).to.include.members(['advertiserDomains']); + expect(Object.keys(result[0].meta.advertiserDomains)).to.deep.equal([]); + }); }); describe('onBidWon', function() { let sandbox; - let bid = { foo: 'bar' }; + const bid = { foo: 'bar' }; beforeEach(function () { sandbox = sinon.sandbox.create();