Skip to content

Commit bfdbf60

Browse files
author
Michele Nasti
committed
final fixes after rebasing
1 parent a43ef42 commit bfdbf60

File tree

2 files changed

+75
-77
lines changed

2 files changed

+75
-77
lines changed

modules/engageyaBidAdapter.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import { createTrackPixelHtml } from '../src/utils.js';
33
import {registerBidder} from '../src/adapters/bidderFactory.js';
44
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
55

6-
const {
7-
registerBidder
8-
} = require('../src/adapters/bidderFactory.js');
96
const BIDDER_CODE = 'engageya';
107
const ENDPOINT_URL = 'https://recs.engageya.com/rec-api/getrecs.json';
118
const ENDPOINT_METHOD = 'GET';

test/spec/modules/prebidServerBidAdapter_spec.js

Lines changed: 75 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,90 +1347,91 @@ describe('S2S Adapter', function () {
13471347
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
13481348
const requestBid = JSON.parse(server.requests[0].requestBody);
13491349

1350-
expect(requestBid.imp[0].native).to.deep.equal({
1351-
request: JSON.stringify({
1352-
'context': 1,
1353-
'plcmttype': 1,
1354-
'eventtrackers': [{
1355-
event: 1,
1356-
methods: [1]
1357-
}],
1358-
'assets': [
1359-
{
1360-
'required': 1,
1361-
'id': 0,
1362-
'title': {
1363-
'len': 800
1364-
}
1365-
},
1366-
{
1367-
'required': 1,
1368-
'id': 1,
1369-
'img': {
1370-
'type': 3,
1371-
'w': 989,
1372-
'h': 742
1373-
}
1374-
},
1375-
{
1376-
'required': 1,
1377-
'id': 2,
1378-
'img': {
1379-
'type': 1,
1380-
'wmin': 10,
1381-
'hmin': 10,
1382-
'ext': {
1383-
'aspectratios': ['1:1']
1350+
expect(requestBid.imp[0].native).to.deep.equal({
1351+
request: JSON.stringify({
1352+
'context': 1,
1353+
'plcmttype': 1,
1354+
'eventtrackers': [{
1355+
event: 1,
1356+
methods: [1]
1357+
}],
1358+
'assets': [
1359+
{
1360+
'required': 1,
1361+
'id': 0,
1362+
'title': {
1363+
'len': 800
1364+
}
1365+
},
1366+
{
1367+
'required': 1,
1368+
'id': 1,
1369+
'img': {
1370+
'type': 3,
1371+
'w': 989,
1372+
'h': 742
1373+
}
1374+
},
1375+
{
1376+
'required': 1,
1377+
'id': 2,
1378+
'img': {
1379+
'type': 1,
1380+
'wmin': 10,
1381+
'hmin': 10,
1382+
'ext': {
1383+
'aspectratios': ['1:1']
1384+
}
1385+
}
1386+
},
1387+
{
1388+
'required': 1,
1389+
'id': 3,
1390+
'data': {
1391+
'type': 1
13841392
}
13851393
}
1386-
},
1387-
{
1388-
'required': 1,
1389-
'id': 3,
1390-
'data': {
1391-
'type': 1
1392-
}
1393-
}
1394-
]
1395-
}),
1396-
ver: '1.2'
1394+
]
1395+
}),
1396+
ver: '1.2'
1397+
});
13971398
});
1398-
});
13991399

1400-
it('adds native ortb request for OpenRTB', function () {
1401-
const _config = {
1402-
s2sConfig: CONFIG
1403-
};
1400+
it('adds native ortb request for OpenRTB', function () {
1401+
const _config = {
1402+
s2sConfig: CONFIG
1403+
};
14041404

1405-
const openRtbNativeRequest = deepClone(REQUEST);
1406-
delete openRtbNativeRequest.ad_units[0].mediaTypes.native;
1407-
delete openRtbNativeRequest.ad_units[0].nativeParams;
1405+
const openRtbNativeRequest = deepClone(REQUEST);
1406+
delete openRtbNativeRequest.ad_units[0].mediaTypes.native;
1407+
delete openRtbNativeRequest.ad_units[0].nativeParams;
14081408

1409-
openRtbNativeRequest.ad_units[0].mediaTypes.native = NATIVE_ORTB_MTO;
1410-
prepRequest(openRtbNativeRequest);
1409+
openRtbNativeRequest.ad_units[0].mediaTypes.native = NATIVE_ORTB_MTO;
1410+
prepRequest(openRtbNativeRequest);
14111411

1412-
config.setConfig(_config);
1413-
adapter.callBids(openRtbNativeRequest, BID_REQUESTS, addBidResponse, done, ajax);
1414-
const requestBid = JSON.parse(server.requests[0].requestBody);
1412+
config.setConfig(_config);
1413+
adapter.callBids(openRtbNativeRequest, BID_REQUESTS, addBidResponse, done, ajax);
1414+
const requestBid = JSON.parse(server.requests[0].requestBody);
14151415

1416-
expect(requestBid.imp[0].native).to.deep.equal({
1417-
request: JSON.stringify(NATIVE_ORTB_MTO.ortb),
1418-
ver: '1.2'
1416+
expect(requestBid.imp[0].native).to.deep.equal({
1417+
request: JSON.stringify(NATIVE_ORTB_MTO.ortb),
1418+
ver: '1.2'
1419+
});
14191420
});
1420-
});
14211421

1422-
it('should not include ext.aspectratios if adunit\'s aspect_ratios do not define radio_width and ratio_height', () => {
1423-
const req = deepClone(REQUEST);
1424-
req.ad_units[0].mediaTypes.native.icon.aspect_ratios[0] = { 'min_width': 1, 'min_height': 2 };
1425-
prepRequest(req);
1426-
adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
1427-
const nativeReq = JSON.parse(JSON.parse(server.requests[0].requestBody).imp[0].native.request);
1428-
const icons = nativeReq.assets.map((a) => a.img).filter((img) => img && img.type === 1);
1429-
expect(icons).to.have.length(1);
1430-
expect(icons[0].hmin).to.equal(2);
1431-
expect(icons[0].wmin).to.equal(1);
1432-
expect(deepAccess(icons[0], 'ext.aspectratios')).to.be.undefined;
1433-
})
1422+
it('should not include ext.aspectratios if adunit\'s aspect_ratios do not define radio_width and ratio_height', () => {
1423+
const req = deepClone(REQUEST);
1424+
req.ad_units[0].mediaTypes.native.icon.aspect_ratios[0] = { 'min_width': 1, 'min_height': 2 };
1425+
prepRequest(req);
1426+
adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
1427+
const nativeReq = JSON.parse(JSON.parse(server.requests[0].requestBody).imp[0].native.request);
1428+
const icons = nativeReq.assets.map((a) => a.img).filter((img) => img && img.type === 1);
1429+
expect(icons).to.have.length(1);
1430+
expect(icons[0].hmin).to.equal(2);
1431+
expect(icons[0].wmin).to.equal(1);
1432+
expect(deepAccess(icons[0], 'ext.aspectratios')).to.be.undefined;
1433+
})
1434+
});
14341435

14351436
it('adds site if app is not present', function () {
14361437
const _config = {

0 commit comments

Comments
 (0)