Skip to content

Commit

Permalink
Function name was not logical (prebid#2751)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaiminpanchal27 authored and StefanWallin committed Sep 28, 2018
1 parent f7d49d0 commit d299f27
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/targeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const MAX_DFP_KEYLENGTH = 20;
const TTL_BUFFER = 1000;

// return unexpired bids
export const isBidExpired = (bid) => (bid.responseTimestamp + bid.ttl * 1000 + TTL_BUFFER) > timestamp();
export const isBidNotExpired = (bid) => (bid.responseTimestamp + bid.ttl * 1000 + TTL_BUFFER) > timestamp();

// return bids whose status is not set. Winning bid can have status `targetingSet` or `rendered`.
const isUnusedBid = (bid) => bid && ((bid.status && !includes([BID_TARGETING_SET, RENDERED], bid.status)) || !bid.status);
Expand Down Expand Up @@ -195,7 +195,7 @@ export function newTargeting(auctionManager) {
function getBidsReceived() {
const bidsReceived = auctionManager.getBidsReceived()
.filter(isUnusedBid)
.filter(exports.isBidExpired)
.filter(exports.isBidNotExpired)
;

return getHighestCpmBidsFromBidPool(bidsReceived, getOldestHighestCpmBid);
Expand Down
10 changes: 5 additions & 5 deletions test/spec/unit/core/targeting_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ describe('targeting tests', () => {
amGetAdUnitsStub = sinon.stub(auctionManager, 'getAdUnitCodes').callsFake(function() {
return ['/123456/header-bid-tag-0'];
});
bidExpiryStub = sinon.stub(targetingModule, 'isBidExpired').returns(true);
bidExpiryStub = sinon.stub(targetingModule, 'isBidNotExpired').returns(true);
});

afterEach(() => {
auctionManager.getBidsReceived.restore();
auctionManager.getAdUnitCodes.restore();
targetingModule.isBidExpired.restore();
targetingModule.isBidNotExpired.restore();
});

it('selects the top bid when _sendAllBids true', () => {
Expand Down Expand Up @@ -149,13 +149,13 @@ describe('targeting tests', () => {
amGetAdUnitsStub = sinon.stub(auctionManager, 'getAdUnitCodes').callsFake(function() {
return ['/123456/header-bid-tag-0'];
});
bidExpiryStub = sinon.stub(targetingModule, 'isBidExpired').returns(true);
bidExpiryStub = sinon.stub(targetingModule, 'isBidNotExpired').returns(true);
});

afterEach(() => {
auctionManager.getBidsReceived.restore();
auctionManager.getAdUnitCodes.restore();
targetingModule.isBidExpired.restore();
targetingModule.isBidNotExpired.restore();
});

it('returns targetingSet correctly', () => {
Expand All @@ -171,7 +171,7 @@ describe('targeting tests', () => {
let bidExpiryStub;
let auctionManagerStub;
beforeEach(() => {
bidExpiryStub = sinon.stub(targetingModule, 'isBidExpired').returns(true);
bidExpiryStub = sinon.stub(targetingModule, 'isBidNotExpired').returns(true);
auctionManagerStub = sinon.stub(auctionManager, 'getBidsReceived');
});

Expand Down
4 changes: 2 additions & 2 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ window.apntag = {
describe('Unit: Prebid Module', function () {
let bidExpiryStub;
before(() => {
bidExpiryStub = sinon.stub(targetingModule, 'isBidExpired').callsFake(() => true);
bidExpiryStub = sinon.stub(targetingModule, 'isBidNotExpired').callsFake(() => true);
});

after(function() {
$$PREBID_GLOBAL$$.adUnits = [];
targetingModule.isBidExpired.restore();
targetingModule.isBidNotExpired.restore();
});

describe('getAdserverTargetingForAdUnitCodeStr', function () {
Expand Down

0 comments on commit d299f27

Please sign in to comment.