Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add find polyfill in unit test to fix browserstack failures #3156

Merged
merged 1 commit into from
Oct 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as ajaxLib from 'src/ajax';
import * as auctionModule from 'src/auction';
import { newBidder, registerBidder } from 'src/adapters/bidderFactory';
import * as targetingModule from 'src/targeting';
import find from 'core-js/library/fn/array/find';

var assert = require('chai').assert;
var expect = require('chai').expect;
Expand Down Expand Up @@ -1849,9 +1850,8 @@ describe('Unit: Prebid Module', function () {
// mark the bid and verify the state has changed to RENDERED
const winningBid = targeting.getWinningBids(adUnitCode)[0];
$$PREBID_GLOBAL$$.markWinningBidAsUsed({ adUnitCode, adId: winningBid.adId });
const markedBid = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode)
.bids
.find(bid => bid.adId === winningBid.adId);
const markedBid = find($$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode).bids,
bid => bid.adId === winningBid.adId);

expect(markedBid.status).to.equal(RENDERED);
resetAuction();
Expand All @@ -1864,9 +1864,8 @@ describe('Unit: Prebid Module', function () {

const winningBid = targeting.getWinningBids(adUnitCode)[0];
$$PREBID_GLOBAL$$.markWinningBidAsUsed({ adUnitCode, adId: 'miss' });
const markedBid = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode)
.bids
.find(bid => bid.adId === winningBid.adId);
const markedBid = find($$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode).bids,
bid => bid.adId === winningBid.adId);

expect(markedBid.status).to.not.equal(RENDERED);
resetAuction();
Expand All @@ -1881,9 +1880,8 @@ describe('Unit: Prebid Module', function () {
// mark the bid and verify the state has changed to RENDERED
const winningBid = targeting.getWinningBids(adUnitCode)[0];
$$PREBID_GLOBAL$$.markWinningBidAsUsed({ adUnitCode });
const markedBid = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode)
.bids
.find(bid => bid.adId === winningBid.adId);
const markedBid = find($$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode).bids,
bid => bid.adId === winningBid.adId);

expect(markedBid.status).to.equal(RENDERED);
resetAuction();
Expand All @@ -1898,9 +1896,8 @@ describe('Unit: Prebid Module', function () {
// mark the bid and verify the state has changed to RENDERED
const winningBid = targeting.getWinningBids(adUnitCode)[0];
$$PREBID_GLOBAL$$.markWinningBidAsUsed({ adId: winningBid.adId });
const markedBid = $$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode)
.bids
.find(bid => bid.adId === winningBid.adId);
const markedBid = find($$PREBID_GLOBAL$$.getBidResponsesForAdUnitCode(adUnitCode).bids,
bid => bid.adId === winningBid.adId);

expect(markedBid.status).to.equal(RENDERED);
resetAuction();
Expand Down