Skip to content

Commit

Permalink
EX-2588 Remove duplicated object initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhalovich committed Sep 14, 2021
1 parent f80878a commit 00ca181
Showing 1 changed file with 18 additions and 47 deletions.
65 changes: 18 additions & 47 deletions test/spec/modules/sovrnBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,20 @@ describe('sovrnBidAdapter', function() {

describe('interpretResponse', function () {
let response;
const baseResponse = {
'requestId': '263c448586f5a1',
'cpm': 0.45882675,
'width': 728,
'height': 90,
'creativeId': 'creativelycreatedcreativecreative',
'dealId': null,
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
'ttl': 90,
'meta': { advertiserDomains: [] }
}
beforeEach(function () {
response = {
body: {
Expand All @@ -357,18 +371,9 @@ describe('sovrnBidAdapter', function() {

it('should get the correct bid response', function () {
const expectedResponse = {
'requestId': '263c448586f5a1',
'cpm': 0.45882675,
'width': 728,
'height': 90,
'creativeId': 'creativelycreatedcreativecreative',
'dealId': null,
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
...baseResponse,
'ad': decodeURIComponent(`<!-- Creative --><img src=<!-- NURL -->>`),
'ttl': 60000,
'meta': { advertiserDomains: [] }
};

const result = spec.interpretResponse(response);
Expand All @@ -380,18 +385,9 @@ describe('sovrnBidAdapter', function() {
delete response.body.seatbid[0].bid[0].crid;

const expectedResponse = {
'requestId': '263c448586f5a1',
'cpm': 0.45882675,
'width': 728,
'height': 90,
...baseResponse,
'creativeId': response.body.seatbid[0].bid[0].id,
'dealId': null,
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
'ttl': 90,
'meta': { advertiserDomains: [] }
}

const result = spec.interpretResponse(response);
Expand All @@ -402,42 +398,17 @@ describe('sovrnBidAdapter', function() {
it('should get correct bid response when dealId is passed', function () {
response.body.seatbid[0].bid[0].dealid = 'baking';

const expectedResponse = {
'requestId': '263c448586f5a1',
'cpm': 0.45882675,
'width': 728,
'height': 90,
'creativeId': 'creativelycreatedcreativecreative',
'dealId': 'baking',
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
'ttl': 90,
'meta': { advertiserDomains: [] }
}

const result = spec.interpretResponse(response)

expect(result[0]).to.deep.equal(expectedResponse);
expect(result[0]).to.deep.equal(baseResponse);
});

it('should get correct bid response when ttl is set', function () {
response.body.seatbid[0].bid[0].ext = { 'ttl': 480 }

const expectedResponse = {
'requestId': '263c448586f5a1',
'cpm': 0.45882675,
'width': 728,
'height': 90,
'creativeId': 'creativelycreatedcreativecreative',
'dealId': null,
'currency': 'USD',
'netRevenue': true,
'mediaType': 'banner',
'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
...baseResponse,
'ttl': 480,
'meta': { advertiserDomains: [] }
}

const result = spec.interpretResponse(response)
Expand Down

0 comments on commit 00ca181

Please sign in to comment.