From 54a8fc1120c0ebe56d081815f04d2084553e9454 Mon Sep 17 00:00:00 2001 From: Filip Stamenkovic Date: Mon, 30 Sep 2024 16:23:07 +0200 Subject: [PATCH] check if video features are enabled for tests --- .../modules/showheroes-bsBidAdapter_spec.js | 160 +++++++++--------- 1 file changed, 81 insertions(+), 79 deletions(-) diff --git a/test/spec/modules/showheroes-bsBidAdapter_spec.js b/test/spec/modules/showheroes-bsBidAdapter_spec.js index 1366ffef3c4a..1b37eeec8925 100644 --- a/test/spec/modules/showheroes-bsBidAdapter_spec.js +++ b/test/spec/modules/showheroes-bsBidAdapter_spec.js @@ -147,101 +147,103 @@ describe('shBidAdapter', () => { } const vastUrl = 'https://test.com/vast/?zid=AACBWAcof-611K4U&u=https://example.org/?foo=bar&gdpr=0&cs=XXXXXXXXXXXXXXXXXXXX&sid=01ecd03ce381505ccdeb88e555b05001&width=300&height=200&prebidmode=1' - it('should get correct bid response when type is video (V2)', function () { - const request = spec.buildRequests([bidRequestVideoV2], bidderRequest) - const expectedResponse = [ - { - cpm: 1, - creativeId: 'c_38b373e1e31c18', - creative_id: 'c_38b373e1e31c18', - currency: 'EUR', - width: 640, - height: 480, - playerHeight: 480, - playerWidth: 640, - mediaType: 'video', - netRevenue: true, - requestId: '38b373e1e31c18', - ttl: 300, - meta: { - advertiserDomains: adomain - }, - vastXml: vastXml, - callbacks: { - won: [callback_won], - }, - extra: 'test', - } - ] + if (FEATURES.VIDEO) { + it('should get correct bid response when type is video (V2)', function () { + const request = spec.buildRequests([bidRequestVideoV2], bidderRequest) + const expectedResponse = [ + { + cpm: 1, + creativeId: 'c_38b373e1e31c18', + creative_id: 'c_38b373e1e31c18', + currency: 'EUR', + width: 640, + height: 480, + playerHeight: 480, + playerWidth: 640, + mediaType: 'video', + netRevenue: true, + requestId: '38b373e1e31c18', + ttl: 300, + meta: { + advertiserDomains: adomain + }, + vastXml: vastXml, + callbacks: { + won: [callback_won], + }, + extra: 'test', + } + ] - const result = spec.interpretResponse({ 'body': basicResponse }, request) - expect(result).to.deep.equal(expectedResponse) - }) + const result = spec.interpretResponse({ 'body': basicResponse }, request) + expect(result).to.deep.equal(expectedResponse) + }) - it('should get correct bid response when type is outstream (slot V2)', function () { - window.myRenderer = { - renderAd: function() { - return null; - } - } - const bidRequestV2 = JSON.parse(JSON.stringify(bidRequestOutstreamV2)); - const bidResponse = JSON.parse(JSON.stringify(basicResponse)); - bidResponse.seatbid[0].bid[0].ext.rendererConfig = { - rendererUrl: 'https://test.com/render.js', - renderFunc: 'myRenderer.renderAd', - renderOptions: { - key: 'my renderer custom value', + it('should get correct bid response when type is outstream (slot V2)', function () { + window.myRenderer = { + renderAd: function() { + return null; + } } - }; - const slotId = 'testSlot2' + const bidRequestV2 = JSON.parse(JSON.stringify(bidRequestOutstreamV2)); + const bidResponse = JSON.parse(JSON.stringify(basicResponse)); + bidResponse.seatbid[0].bid[0].ext.rendererConfig = { + rendererUrl: 'https://test.com/render.js', + renderFunc: 'myRenderer.renderAd', + renderOptions: { + key: 'my renderer custom value', + } + }; + const slotId = 'testSlot2' - const container = document.createElement('div') - container.setAttribute('id', slotId) - document.body.appendChild(container) + const container = document.createElement('div') + container.setAttribute('id', slotId) + document.body.appendChild(container) - const request = spec.buildRequests([bidRequestV2], bidderRequest) + const request = spec.buildRequests([bidRequestV2], bidderRequest) - const result = spec.interpretResponse({ 'body': bidResponse }, request) - const bid = result[0] - expect(bid).to.have.property('mediaType', VIDEO); - expect(typeof bid.renderer).to.be.eql('object'); - expect(bid.renderer.url).to.eql('https://test.com/render.js'); + const result = spec.interpretResponse({ 'body': bidResponse }, request) + const bid = result[0] + expect(bid).to.have.property('mediaType', VIDEO); + expect(typeof bid.renderer).to.be.eql('object'); + expect(bid.renderer.url).to.eql('https://test.com/render.js'); - sinon.spy(window.myRenderer, 'renderAd'); - bid.renderer.render(bid); + sinon.spy(window.myRenderer, 'renderAd'); + bid.renderer.render(bid); - const renderCall = window.myRenderer.renderAd.getCall(0); - const renderPayload = renderCall.args[0]; - expect(renderPayload.adResponse.content).to.eql(vastXml); - expect(renderPayload.key).to.eql('my renderer custom value'); - }) + const renderCall = window.myRenderer.renderAd.getCall(0); + const renderPayload = renderCall.args[0]; + expect(renderPayload.adResponse.content).to.eql(vastXml); + expect(renderPayload.key).to.eql('my renderer custom value'); + }) - it('should get correct bid response when type is outstream (customRender)', function () { - const bidRequest = JSON.parse(JSON.stringify(bidRequestOutstreamV2)); + it('should get correct bid response when type is outstream (customRender)', function () { + const bidRequest = JSON.parse(JSON.stringify(bidRequestOutstreamV2)); - const request = spec.buildRequests([bidRequest], bidderRequest) + const request = spec.buildRequests([bidRequest], bidderRequest) - const result = spec.interpretResponse({ 'body': basicResponse }, request) - const bid = result[0]; - expect(bid).to.have.property('mediaType', VIDEO); + const result = spec.interpretResponse({ 'body': basicResponse }, request) + const bid = result[0]; + expect(bid).to.have.property('mediaType', VIDEO); - expect(bid.vastXml).to.eql(vastXml); - }) + expect(bid.vastXml).to.eql(vastXml); + }) - it('should get vast url', function () { - const bidRequest = JSON.parse(JSON.stringify(bidRequestOutstreamV2)); - const bidResponse = JSON.parse(JSON.stringify(basicResponse)); - bidResponse.seatbid[0].bid[0].nurl = vastUrl + it('should get vast url', function () { + const bidRequest = JSON.parse(JSON.stringify(bidRequestOutstreamV2)); + const bidResponse = JSON.parse(JSON.stringify(basicResponse)); + bidResponse.seatbid[0].bid[0].nurl = vastUrl - const request = spec.buildRequests([bidRequest], bidderRequest) + const request = spec.buildRequests([bidRequest], bidderRequest) - const result = spec.interpretResponse({ 'body': bidResponse }, request) - const bid = result[0]; - expect(bid).to.have.property('mediaType', VIDEO); + const result = spec.interpretResponse({ 'body': bidResponse }, request) + const bid = result[0]; + expect(bid).to.have.property('mediaType', VIDEO); - expect(bid.vastXml).to.eql(vastXml); - expect(bid.vastUrl).to.eql(vastUrl); - }) + expect(bid.vastXml).to.eql(vastXml); + expect(bid.vastUrl).to.eql(vastUrl); + }) + } }); describe('getUserSyncs', function () {