Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

Commit

Permalink
Update code to ESlint rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhukovsky committed Jul 11, 2017
1 parent 1c9556d commit be01333
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 39 deletions.
6 changes: 2 additions & 4 deletions src/adapters/analytics/aol.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default Object.assign(adapter({
this.server = options ? options.server : null;
this.adUnits = {};

//first send all events fired before enableAnalytics called
// first send all events fired before enableAnalytics called
events.getEvents().forEach(event => {
if (!event) {
return;
Expand All @@ -68,7 +68,7 @@ export default Object.assign(adapter({
};
},

//override AnalyticsAdapter functions by supplying custom methods
// override AnalyticsAdapter functions by supplying custom methods
track({ eventType, args }) {
switch (eventType) {
case AUCTION_END:
Expand Down Expand Up @@ -213,7 +213,6 @@ export default Object.assign(adapter({
let baseSchema, url;

switch (event) {

case EVENTS.AUCTION:

baseSchema = this.getBaseSchema(EVENTS.AUCTION, adUnit);
Expand All @@ -234,7 +233,6 @@ export default Object.assign(adapter({
let winSchema = this.getWinSchema(adUnit);
url = baseSchemaTemplate(baseSchema) + winSchemaTemplate(winSchema);
return url;

}
},

Expand Down
2 changes: 1 addition & 1 deletion src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ $$PREBID_GLOBAL$$.requestBids = function ({ bidsBackHandler, timeout, adUnits, a
timeouts.sort((a, b) => a - b);
}

//set timeout(s) for all bids
// set timeout(s) for all bids
bidmanager.setTimeouts(timeouts);

adaptermanager.callBids({ adUnits, adUnitCodes, cbTimeout });
Expand Down
38 changes: 16 additions & 22 deletions test/spec/adapters/aol_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ import * as utils from 'src/utils';
import AolAdapter from 'src/adapters/aol';
import bidmanager from 'src/bidmanager';


let getDefaultBidResponse = () => {
return {
"id": "245730051428950632",
"cur": "USD",
"seatbid": [{
"bid": [{
"id": 1,
"impid": "245730051428950632",
"price": 0.09,
"adm": "<script>logInfo('ad');</script>",
"crid": "0",
"h": 90,
"w": 728,
"ext": {"sizeid": 225}
id: '245730051428950632',
cur: 'USD',
seatbid: [{
bid: [{
id: 1,
impid: '245730051428950632',
price: 0.09,
adm: '<script>logInfo(\'ad\');</script>',
crid: '0',
h: 90,
w: 728,
ext: {sizeid: 225}
}]
}]
};
Expand Down Expand Up @@ -93,9 +92,7 @@ describe('AolAdapter', () => {
});

describe('bid request', () => {

describe('Marketplace api', () => {

let xhr;
let requests;

Expand Down Expand Up @@ -301,7 +298,6 @@ describe('AolAdapter', () => {
});

describe('Nexage api', () => {

let xhr;
let requests;

Expand Down Expand Up @@ -427,11 +423,9 @@ describe('AolAdapter', () => {
})
;
});

});

describe('bid response', () => {

let server;

beforeEach(() => {
Expand Down Expand Up @@ -579,10 +573,10 @@ describe('AolAdapter', () => {
expect(bidmanager.addBidResponse.calledOnce).to.be.true;
var addedBidResponse = bidmanager.addBidResponse.firstCall.args[1];
expect(addedBidResponse.ad).to.equal(
"<script>logInfo('ad');</script>" +
"<script>if(!parent.$$PREBID_GLOBAL$$.aolGlobals.pixelsDropped){" +
"parent.$$PREBID_GLOBAL$$.aolGlobals.pixelsDropped=true;" +
"document.write('<img src=\"pixel.gif\">');}</script>"
'<script>logInfo(\'ad\');</script>' +
'<script>if(!parent.$$PREBID_GLOBAL$$.aolGlobals.pixelsDropped){' +
'parent.$$PREBID_GLOBAL$$.aolGlobals.pixelsDropped=true;' +
'document.write(\'<img src=\"pixel.gif\">\');}</script>'
);
});

Expand Down
19 changes: 9 additions & 10 deletions test/spec/loaders/adapterLoader_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ const allAdapters = require('../../fixtures/allAdapters');
const expect = require('chai').expect;
require('../../../loaders/adapterLoader');

const defaultAdapters = ["aardvark","adblade","adbutler","adequant","adform","admedia","aol","appnexus","appnexusAst","getintent","hiromedia","indexExchange","kruxlink","komoona","openx","piximedia","pubmatic","pulsepoint","rubicon","sonobi","sovrn","springserve","thoughtleadr","triplelift","twenga","yieldbot","nginad","brightcom","wideorbit","jcm","underdogmedia","memeglobal","centro","roxot",{"appnexus":{"alias":"brealtime"}},{"appnexus":{"alias":"pagescience"}},{"appnexus":{"alias":"defymedia"}},{"appnexusAst":{"supportedMediaTypes":["video"]}}];
const defaultAdapters = ['aardvark', 'adblade', 'adbutler', 'adequant', 'adform', 'admedia', 'aol', 'appnexus', 'appnexusAst', 'getintent', 'hiromedia', 'indexExchange', 'kruxlink', 'komoona', 'openx', 'piximedia', 'pubmatic', 'pulsepoint', 'rubicon', 'sonobi', 'sovrn', 'springserve', 'thoughtleadr', 'triplelift', 'twenga', 'yieldbot', 'nginad', 'brightcom', 'wideorbit', 'jcm', 'underdogmedia', 'memeglobal', 'centro', 'roxot', {'appnexus': {'alias': 'brealtime'}}, {'appnexus': {'alias': 'pagescience'}}, {'appnexus': {'alias': 'defymedia'}}, {'appnexusAst': {'supportedMediaTypes': ['video']}}];

const input = `/** INSERT ADAPTERS - DO NOT EDIT OR REMOVE */
/** END INSERT ADAPTERS */`;

const delimiter = '/*!ADAPTER REGISTER DELIMITER*/';

const getAdaptersWithDelimiter = () => {
return delimiter +'var AardvarkAdapter = require(\'./adapters/aardvark.js\');\n ' +
return delimiter + 'var AardvarkAdapter = require(\'./adapters/aardvark.js\');\n ' +
'exports.registerBidAdapter(new AardvarkAdapter(), \'aardvark\');\n' +
delimiter +
'var AolAdapter = require(\'./adapters/aol.js\');\n ' +
Expand All @@ -37,18 +37,18 @@ describe('adapterLoader.js', () => {
'aol',
'appnexus',
'rubicon',
{"appnexus":{"alias":"pagescience"}},
{"appnexusAst":{"supportedMediaTypes":["video"]}}
{appnexus: {alias: 'pagescience'}},
{appnexusAst: {supportedMediaTypes: ['video']}}
];
const loader = proxyquire('../../../loaders/adapterLoader', {'./getAdapters' : getAdapterStub});
const loader = proxyquire('../../../loaders/adapterLoader', {'./getAdapters': getAdapterStub});
let output = loader(input);
expect(output).to.equal(getAdaptersWithDelimiter());
});

it('should return custom adapter list if file exists', () => {
const customAdapter = [{customAdapterName :{srcPath: '/somepath/customAdapterName.js'}}];
const customAdapter = [{customAdapterName: {srcPath: '/somepath/customAdapterName.js'}}];
const getAdapterStub = () => customAdapter;
const loader = proxyquire('../../../loaders/adapterLoader', {'fs': {existsSync : ()=> true }, './getAdapters' : getAdapterStub});
const loader = proxyquire('../../../loaders/adapterLoader', {'fs': {existsSync: () => true }, './getAdapters': getAdapterStub});
let output = loader(input);
const expected = delimiter +
'let customAdapterName = require(\'/somepath/customAdapterName.js\');\n ' +
Expand All @@ -59,9 +59,9 @@ describe('adapterLoader.js', () => {
});

it('should ignore custom adapters that that do not exist', () => {
const customAdapter = ['appnexus', {customAdapterName :{srcPath: '/somepath/customAdapterName.js'}}];
const customAdapter = ['appnexus', {customAdapterName: {srcPath: '/somepath/customAdapterName.js'}}];
const getAdapterStub = () => customAdapter;
const loader = proxyquire('../../../loaders/adapterLoader', {'fs': {existsSync : ()=> false }, './getAdapters' : getAdapterStub});
const loader = proxyquire('../../../loaders/adapterLoader', {'fs': {existsSync: () => false}, './getAdapters': getAdapterStub});
let output = loader(input);
const expected = delimiter +
'var AppnexusAdapter = require(\'./adapters/appnexus.js\');\n ' +
Expand All @@ -70,5 +70,4 @@ describe('adapterLoader.js', () => {
'exports.videoAdapters = [];';
expect(output).to.equal(expected);
});

});
2 changes: 0 additions & 2 deletions test/spec/unit/adapters/analytics/aol_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const ANALYTICS_EVENTS = {
};

describe('AOL analytics adapter', () => {

before(() => {
aolAnalytics.enableAnalytics({});
});
Expand Down Expand Up @@ -1398,7 +1397,6 @@ describe('AOL analytics adapter', () => {
adUnit.code = 'ad@code+';
adUnit.adIdExtension = '$test&@adI#d/post=fix+encoding';


expect(aolAnalytics.generateAdId(adUnit)).to.equal(encodeURIComponent(adUnit.code + '-' + adUnit.adIdExtension));
});
});
Expand Down

0 comments on commit be01333

Please sign in to comment.