prebid.js 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/a1MediaRtdProvider.js +1 -0
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adfBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adkernelAdnBidAdapter.js +1 -1
- package/dist/adkernelBidAdapter.js +1 -1
- package/dist/admixerIdSystem.js +1 -1
- package/dist/adnuntiusBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adqueryIdSystem.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtelligentIdSystem.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/beachfrontBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/britepoolIdSystem.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectIdSystem.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagementGpp.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/criteoIdSystem.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/czechAdIdSystem.js +1 -1
- package/dist/dacIdSystem.js +1 -1
- package/dist/deepintentDpesIdSystem.js +1 -1
- package/dist/dependencies.json +3 -0
- package/dist/dmdIdSystem.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/fabrickIdSystem.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/ftrackIdSystem.js +1 -1
- package/dist/geolocationRtdProvider.js +1 -0
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gravitoIdSystem.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/growthCodeIdSystem.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hadronIdSystem.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/identityLinkIdSystem.js +1 -1
- package/dist/idxIdSystem.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/imuIdSystem.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/intentIqIdSystem.js +1 -1
- package/dist/invibesBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justIdSystem.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/kinessoIdSystem.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/kulturemediaBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentIdSystem.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/lotamePanoramaIdSystem.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/merkleIdSystem.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/minutemediaplusBidAdapter.js +1 -1
- package/dist/mwOpenLinkIdSystem.js +1 -1
- package/dist/naveggIdSystem.js +1 -1
- package/dist/netIdSystem.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +176 -173
- package/dist/novatiqIdSystem.js +1 -1
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/oneKeyIdSystem.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/ozoneBidAdapter.js +1 -1
- package/dist/pairIdSystem.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/quantcastIdSystem.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharedIdSystem.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/silverpushBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/ssmasBidAdapter.js +1 -0
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/tapadIdSystem.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/tncIdSystem.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/unifiedIdSystem.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/utiqSystem.js +1 -1
- package/dist/verizonMediaIdSystem.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vrtcalBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/zeotapIdPlusIdSystem.js +1 -1
- package/integrationExamples/gpt/adUnitFloors.html +0 -1
- package/modules/.submodules.json +1 -0
- package/modules/33acrossIdSystem.js +9 -0
- package/modules/a1MediaRtdProvider.js +92 -0
- package/modules/a1MediaRtdProvider.md +46 -0
- package/modules/adfBidAdapter.js +4 -1
- package/modules/adkernelAdnBidAdapter.js +1 -1
- package/modules/adkernelBidAdapter.js +10 -3
- package/modules/admixerIdSystem.js +6 -0
- package/modules/adnuntiusBidAdapter.js +5 -13
- package/modules/adqueryIdSystem.js +6 -0
- package/modules/adtelligentIdSystem.js +6 -0
- package/modules/adyoulikeBidAdapter.js +6 -3
- package/modules/amxIdSystem.js +6 -0
- package/modules/beachfrontBidAdapter.js +32 -6
- package/modules/britepoolIdSystem.js +6 -0
- package/modules/connectIdSystem.js +6 -0
- package/modules/consentManagementGpp.js +10 -1
- package/modules/consumableBidAdapter.js +9 -1
- package/modules/criteoIdSystem.js +6 -0
- package/modules/czechAdIdSystem.js +6 -0
- package/modules/dacIdSystem.js +6 -0
- package/modules/deepintentDpesIdSystem.js +7 -2
- package/modules/dmdIdSystem.js +6 -0
- package/modules/euidIdSystem.js +9 -0
- package/modules/fabrickIdSystem.js +6 -0
- package/modules/ftrackIdSystem.js +16 -0
- package/modules/geolocationRtdProvider.js +65 -0
- package/modules/gravitoIdSystem.js +6 -0
- package/modules/greenbidsRtdProvider.js +1 -1
- package/modules/growthCodeIdSystem.js +20 -1
- package/modules/hadronIdSystem.js +6 -0
- package/modules/id5IdSystem.js +34 -8
- package/modules/identityLinkIdSystem.js +6 -0
- package/modules/idxIdSystem.js +6 -0
- package/modules/imdsBidAdapter.js +38 -14
- package/modules/imuIdSystem.js +10 -0
- package/modules/intentIqIdSystem.js +6 -0
- package/modules/invibesBidAdapter.js +5 -5
- package/modules/ixBidAdapter.js +16 -0
- package/modules/justIdSystem.js +6 -0
- package/modules/kinessoIdSystem.js +7 -2
- package/modules/liveIntentIdSystem.js +53 -0
- package/modules/lotamePanoramaIdSystem.js +6 -0
- package/modules/merkleIdSystem.js +24 -0
- package/modules/mwOpenLinkIdSystem.js +6 -0
- package/modules/naveggIdSystem.js +6 -0
- package/modules/netIdSystem.js +6 -0
- package/modules/novatiqIdSystem.js +12 -0
- package/modules/oneKeyIdSystem.js +26 -0
- package/modules/ozoneBidAdapter.js +65 -18
- package/modules/ozoneBidAdapter.md +3 -1
- package/modules/pairIdSystem.js +6 -0
- package/modules/parrableIdSystem.js +38 -2
- package/modules/publinkIdSystem.js +7 -1
- package/modules/quantcastIdSystem.js +6 -0
- package/modules/rubiconBidAdapter.js +9 -0
- package/modules/sharedIdSystem.js +6 -0
- package/modules/silverpushBidAdapter.js +2 -2
- package/modules/ssmasBidAdapter.js +126 -0
- package/modules/ssmasBidAdapter.md +35 -0
- package/modules/sspBCBidAdapter.js +36 -13
- package/modules/tapadIdSystem.js +6 -0
- package/modules/tncIdSystem.js +6 -0
- package/modules/tripleliftBidAdapter.js +5 -0
- package/modules/uid2IdSystem.js +14 -0
- package/modules/unifiedIdSystem.js +11 -0
- package/modules/userId/eids.js +6 -445
- package/modules/userId/index.js +36 -24
- package/modules/utiqSystem.js +9 -0
- package/modules/verizonMediaIdSystem.js +6 -0
- package/modules/vrtcalBidAdapter.js +10 -6
- package/modules/zeotapIdPlusIdSystem.js +6 -0
- package/package.json +1 -1
- package/src/adapters/bidderFactory.js +15 -6
- package/src/adloader.js +2 -1
- package/test/spec/modules/a1MediaRtdProvider_spec.js +105 -0
- package/test/spec/modules/adfBidAdapter_spec.js +47 -0
- package/test/spec/modules/adkernelAdnBidAdapter_spec.js +1 -2
- package/test/spec/modules/adkernelBidAdapter_spec.js +7 -2
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +116 -64
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +13 -24
- package/test/spec/modules/beachfrontBidAdapter_spec.js +35 -2
- package/test/spec/modules/consentManagementGpp_spec.js +16 -0
- package/test/spec/modules/consumableBidAdapter_spec.js +15 -0
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +5 -5
- package/test/spec/modules/geolocationRtdProvider_spec.js +119 -0
- package/test/spec/modules/greenbidsRtdProvider_spec.js +1 -1
- package/test/spec/modules/id5IdSystem_spec.js +18 -0
- package/test/spec/modules/imdsBidAdapter_spec.js +98 -17
- package/test/spec/modules/invibesBidAdapter_spec.js +123 -32
- package/test/spec/modules/ixBidAdapter_spec.js +23 -5
- package/test/spec/modules/medianetBidAdapter_spec.js +117 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +3 -5
- package/test/spec/modules/ozoneBidAdapter_spec.js +27 -1
- package/test/spec/modules/prebidServerBidAdapter_spec.js +2 -20
- package/test/spec/modules/priceFloors_spec.js +14 -0
- package/test/spec/modules/pubmaticBidAdapter_spec.js +6 -373
- package/test/spec/modules/rubiconBidAdapter_spec.js +220 -9
- package/test/spec/modules/smaatoBidAdapter_spec.js +4 -6
- package/test/spec/modules/ssmasBidAdapter_spec.js +244 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +18 -19
- package/test/spec/modules/tripleliftBidAdapter_spec.js +40 -0
- package/test/spec/modules/userId_spec.js +116 -7
- package/test/spec/modules/vrtcalBidAdapter_spec.js +12 -4
- package/test/spec/modules/xeBidAdapter_spec.js +366 -368
- package/test/spec/modules/yahoosspBidAdapter_spec.js +5 -18
- package/test/spec/unit/core/bidderFactory_spec.js +61 -14
- package/integrationExamples/gpt/pbjs_video_adUnit.html +0 -109
|
@@ -41,414 +41,412 @@ defaultRequestVideo.mediaTypes = {
|
|
|
41
41
|
skipppable: true
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
+
describe('xeBidAdapter', () => {
|
|
45
|
+
describe('isBidRequestValid', function () {
|
|
46
|
+
it('should return false when request params is missing', function () {
|
|
47
|
+
const invalidRequest = deepClone(defaultRequest);
|
|
48
|
+
delete invalidRequest.params;
|
|
49
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
50
|
+
});
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should return false when required env param is missing', function () {
|
|
53
|
-
const invalidRequest = deepClone(defaultRequest);
|
|
54
|
-
delete invalidRequest.params.env;
|
|
55
|
-
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
56
|
-
});
|
|
52
|
+
it('should return false when required env param is missing', function () {
|
|
53
|
+
const invalidRequest = deepClone(defaultRequest);
|
|
54
|
+
delete invalidRequest.params.env;
|
|
55
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
56
|
+
});
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
it('should return false when required placement param is missing', function () {
|
|
59
|
+
const invalidRequest = deepClone(defaultRequest);
|
|
60
|
+
delete invalidRequest.params.placement;
|
|
61
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
62
|
+
});
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
it('should return false when video.playerSize is missing', function () {
|
|
65
|
+
const invalidRequest = deepClone(defaultRequestVideo);
|
|
66
|
+
delete invalidRequest.mediaTypes.video.playerSize;
|
|
67
|
+
expect(spec.isBidRequestValid(invalidRequest)).to.equal(false);
|
|
68
|
+
});
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
it('should return true when required params found', function () {
|
|
71
|
+
expect(spec.isBidRequestValid(defaultRequest)).to.equal(true);
|
|
72
|
+
});
|
|
72
73
|
});
|
|
73
|
-
});
|
|
74
74
|
|
|
75
|
-
describe('buildRequests', function () {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
describe('buildRequests', function () {
|
|
76
|
+
beforeEach(function () {
|
|
77
|
+
config.resetConfig();
|
|
78
|
+
});
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
it('should send request with correct structure', function () {
|
|
81
|
+
const request = spec.buildRequests([defaultRequest], {});
|
|
82
|
+
expect(request.method).to.equal('POST');
|
|
83
|
+
expect(request.url).to.equal(ENDPOINT);
|
|
84
|
+
expect(request.options).to.have.property('contentType').and.to.equal('application/json');
|
|
85
|
+
expect(request).to.have.property('data');
|
|
86
|
+
});
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
it('should build basic request structure', function () {
|
|
89
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0];
|
|
90
|
+
expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId);
|
|
91
|
+
expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.auctionId);
|
|
92
|
+
expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.ortb2Imp.ext.tid);
|
|
93
|
+
expect(request).to.have.property('tz').and.to.equal(new Date().getTimezoneOffset());
|
|
94
|
+
expect(request).to.have.property('bc').and.to.equal(1);
|
|
95
|
+
expect(request).to.have.property('floor').and.to.equal(null);
|
|
96
|
+
expect(request).to.have.property('banner').and.to.deep.equal({ sizes: [[300, 250], [300, 200]] });
|
|
97
|
+
expect(request).to.have.property('gdprApplies').and.to.equal(0);
|
|
98
|
+
expect(request).to.have.property('consentString').and.to.equal('');
|
|
99
|
+
expect(request).to.have.property('userEids').and.to.deep.equal([]);
|
|
100
|
+
expect(request).to.have.property('usPrivacy').and.to.equal('');
|
|
101
|
+
expect(request).to.have.property('coppa').and.to.equal(0);
|
|
102
|
+
expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']);
|
|
103
|
+
expect(request).to.have.property('ext').and.to.deep.equal({});
|
|
104
|
+
expect(request).to.have.property('env').and.to.deep.equal({
|
|
105
|
+
env: 'xe',
|
|
106
|
+
placement: 'test-banner'
|
|
107
|
+
});
|
|
108
|
+
expect(request).to.have.property('device').and.to.deep.equal({
|
|
109
|
+
ua: navigator.userAgent,
|
|
110
|
+
lang: navigator.language
|
|
111
|
+
});
|
|
111
112
|
});
|
|
112
|
-
});
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
it('should build request with schain', function () {
|
|
115
|
+
const schainRequest = deepClone(defaultRequest);
|
|
116
|
+
schainRequest.schain = {
|
|
117
|
+
validation: 'strict',
|
|
118
|
+
config: {
|
|
119
|
+
ver: '1.0'
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const request = JSON.parse(spec.buildRequests([schainRequest], {}).data)[0];
|
|
123
|
+
expect(request).to.have.property('schain').and.to.deep.equal({
|
|
124
|
+
validation: 'strict',
|
|
125
|
+
config: {
|
|
126
|
+
ver: '1.0'
|
|
127
|
+
}
|
|
128
|
+
});
|
|
128
129
|
});
|
|
129
|
-
});
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
131
|
+
it('should build request with location', function () {
|
|
132
|
+
const bidderRequest = {
|
|
133
|
+
refererInfo: {
|
|
134
|
+
page: 'page',
|
|
135
|
+
location: 'location',
|
|
136
|
+
domain: 'domain',
|
|
137
|
+
ref: 'ref',
|
|
138
|
+
isAmp: false
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0];
|
|
142
|
+
expect(request).to.have.property('location');
|
|
143
|
+
const location = request.location;
|
|
144
|
+
expect(location).to.have.property('page').and.to.equal('page');
|
|
145
|
+
expect(location).to.have.property('location').and.to.equal('location');
|
|
146
|
+
expect(location).to.have.property('domain').and.to.equal('domain');
|
|
147
|
+
expect(location).to.have.property('ref').and.to.equal('ref');
|
|
148
|
+
expect(location).to.have.property('isAmp').and.to.equal(false);
|
|
149
|
+
});
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
it('should build request with ortb2 info', function () {
|
|
152
|
+
const ortb2Request = deepClone(defaultRequest);
|
|
153
|
+
ortb2Request.ortb2 = {
|
|
154
|
+
site: {
|
|
155
|
+
name: 'name'
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const request = JSON.parse(spec.buildRequests([ortb2Request], {}).data)[0];
|
|
159
|
+
expect(request).to.have.property('ortb2').and.to.deep.equal({
|
|
160
|
+
site: {
|
|
161
|
+
name: 'name'
|
|
162
|
+
}
|
|
163
|
+
});
|
|
163
164
|
});
|
|
164
|
-
});
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
it('should build request with ortb2Imp info', function () {
|
|
167
|
+
const ortb2ImpRequest = deepClone(defaultRequest);
|
|
168
|
+
ortb2ImpRequest.ortb2Imp = {
|
|
169
|
+
ext: {
|
|
170
|
+
data: {
|
|
171
|
+
pbadslot: 'home1',
|
|
172
|
+
adUnitSpecificAttribute: '1'
|
|
173
|
+
}
|
|
173
174
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
};
|
|
176
|
+
const request = JSON.parse(spec.buildRequests([ortb2ImpRequest], {}).data)[0];
|
|
177
|
+
expect(request).to.have.property('ortb2Imp').and.to.deep.equal({
|
|
178
|
+
ext: {
|
|
179
|
+
data: {
|
|
180
|
+
pbadslot: 'home1',
|
|
181
|
+
adUnitSpecificAttribute: '1'
|
|
182
|
+
}
|
|
182
183
|
}
|
|
183
|
-
}
|
|
184
|
+
});
|
|
184
185
|
});
|
|
185
|
-
});
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
it('should build request with valid bidfloor', function () {
|
|
188
|
+
const bfRequest = deepClone(defaultRequest);
|
|
189
|
+
bfRequest.getFloor = () => ({ floor: 5, currency: 'USD' });
|
|
190
|
+
const request = JSON.parse(spec.buildRequests([bfRequest], {}).data)[0];
|
|
191
|
+
expect(request).to.have.property('floor').and.to.equal(5);
|
|
192
|
+
});
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
194
|
+
it('should build request with gdpr consent data if applies', function () {
|
|
195
|
+
const bidderRequest = {
|
|
196
|
+
gdprConsent: {
|
|
197
|
+
gdprApplies: true,
|
|
198
|
+
consentString: 'qwerty'
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0];
|
|
202
|
+
expect(request).to.have.property('gdprApplies').and.equals(1);
|
|
203
|
+
expect(request).to.have.property('consentString').and.equals('qwerty');
|
|
204
|
+
});
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
it('should build request with usp consent data if applies', function () {
|
|
207
|
+
const bidderRequest = {
|
|
208
|
+
uspConsent: '1YA-'
|
|
209
|
+
};
|
|
210
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0];
|
|
211
|
+
expect(request).to.have.property('usPrivacy').and.equals('1YA-');
|
|
212
|
+
});
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
it('should build request with coppa 1', function () {
|
|
215
|
+
config.setConfig({
|
|
216
|
+
coppa: true
|
|
217
|
+
});
|
|
218
|
+
const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0];
|
|
219
|
+
expect(request).to.have.property('coppa').and.equals(1);
|
|
217
220
|
});
|
|
218
|
-
const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0];
|
|
219
|
-
expect(request).to.have.property('coppa').and.equals(1);
|
|
220
|
-
});
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
{ source: 'pubcid.org', uids: [ { id: 'pubCommonId_FROM_USER_ID_MODULE', atype: 1 } ] }
|
|
232
|
-
]);
|
|
233
|
-
});
|
|
222
|
+
it('should build request with extended ids', function () {
|
|
223
|
+
const idRequest = deepClone(defaultRequest);
|
|
224
|
+
idRequest.userIdAsEids = [
|
|
225
|
+
{ source: 'adserver.org', uids: [ { id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: { rtiPartner: 'TDID' } } ] },
|
|
226
|
+
{ source: 'pubcid.org', uids: [ { id: 'pubCommonId_FROM_USER_ID_MODULE', atype: 1 } ] }
|
|
227
|
+
];
|
|
228
|
+
const request = JSON.parse(spec.buildRequests([idRequest], {}).data)[0];
|
|
229
|
+
expect(request).to.have.property('userEids').and.deep.equal(idRequest.userIdAsEids);
|
|
230
|
+
});
|
|
234
231
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
232
|
+
it('should build request with video', function () {
|
|
233
|
+
const request = JSON.parse(spec.buildRequests([defaultRequestVideo], {}).data)[0];
|
|
234
|
+
expect(request).to.have.property('video').and.to.deep.equal({
|
|
235
|
+
playerSize: [640, 480],
|
|
236
|
+
context: 'instream',
|
|
237
|
+
skipppable: true
|
|
238
|
+
});
|
|
239
|
+
expect(request).to.have.property('sizes').and.to.deep.equal(['640x480']);
|
|
241
240
|
});
|
|
242
|
-
expect(request).to.have.property('sizes').and.to.deep.equal(['640x480']);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
describe('interpretResponse', function () {
|
|
247
|
-
it('should return empty bids', function () {
|
|
248
|
-
const serverResponse = {
|
|
249
|
-
body: {
|
|
250
|
-
data: null
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const invalidResponse = spec.interpretResponse(serverResponse, {});
|
|
255
|
-
expect(invalidResponse).to.be.an('array').that.is.empty;
|
|
256
241
|
});
|
|
257
242
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
width: 300,
|
|
266
|
-
height: 250,
|
|
267
|
-
ttl: 600,
|
|
268
|
-
meta: {
|
|
269
|
-
advertiserDomains: ['xe.works']
|
|
270
|
-
},
|
|
271
|
-
ext: {
|
|
272
|
-
pixels: [
|
|
273
|
-
[ 'iframe', 'surl1' ],
|
|
274
|
-
[ 'image', 'surl2' ],
|
|
275
|
-
]
|
|
276
|
-
}
|
|
277
|
-
}]
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
const validResponse = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequest });
|
|
282
|
-
const bid = validResponse[0];
|
|
283
|
-
expect(validResponse).to.be.an('array').that.is.not.empty;
|
|
284
|
-
expect(bid.requestId).to.equal('qwerty');
|
|
285
|
-
expect(bid.cpm).to.equal(1);
|
|
286
|
-
expect(bid.currency).to.equal('USD');
|
|
287
|
-
expect(bid.width).to.equal(300);
|
|
288
|
-
expect(bid.height).to.equal(250);
|
|
289
|
-
expect(bid.ttl).to.equal(600);
|
|
290
|
-
expect(bid.meta).to.deep.equal({ advertiserDomains: ['xe.works'] });
|
|
291
|
-
});
|
|
243
|
+
describe('interpretResponse', function () {
|
|
244
|
+
it('should return empty bids', function () {
|
|
245
|
+
const serverResponse = {
|
|
246
|
+
body: {
|
|
247
|
+
data: null
|
|
248
|
+
}
|
|
249
|
+
};
|
|
292
250
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
data: [{
|
|
297
|
-
requestId: 'qwerty',
|
|
298
|
-
cpm: 1,
|
|
299
|
-
currency: 'USD',
|
|
300
|
-
width: 300,
|
|
301
|
-
height: 250,
|
|
302
|
-
ttl: 600,
|
|
303
|
-
mediaType: 'banner',
|
|
304
|
-
creativeId: 'xe-demo-banner',
|
|
305
|
-
ad: 'ad',
|
|
306
|
-
meta: {}
|
|
307
|
-
}]
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const validResponseBanner = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequest });
|
|
312
|
-
const bid = validResponseBanner[0];
|
|
313
|
-
expect(validResponseBanner).to.be.an('array').that.is.not.empty;
|
|
314
|
-
expect(bid.mediaType).to.equal('banner');
|
|
315
|
-
expect(bid.creativeId).to.equal('xe-demo-banner');
|
|
316
|
-
expect(bid.ad).to.equal('ad');
|
|
317
|
-
});
|
|
251
|
+
const invalidResponse = spec.interpretResponse(serverResponse, {});
|
|
252
|
+
expect(invalidResponse).to.be.an('array').that.is.empty;
|
|
253
|
+
});
|
|
318
254
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
255
|
+
it('should interpret valid response', function () {
|
|
256
|
+
const serverResponse = {
|
|
257
|
+
body: {
|
|
258
|
+
data: [{
|
|
259
|
+
requestId: 'qwerty',
|
|
260
|
+
cpm: 1,
|
|
261
|
+
currency: 'USD',
|
|
262
|
+
width: 300,
|
|
263
|
+
height: 250,
|
|
264
|
+
ttl: 600,
|
|
265
|
+
meta: {
|
|
266
|
+
advertiserDomains: ['xe.works']
|
|
267
|
+
},
|
|
268
|
+
ext: {
|
|
269
|
+
pixels: [
|
|
270
|
+
[ 'iframe', 'surl1' ],
|
|
271
|
+
[ 'image', 'surl2' ],
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
}]
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const validResponse = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequest });
|
|
279
|
+
const bid = validResponse[0];
|
|
280
|
+
expect(validResponse).to.be.an('array').that.is.not.empty;
|
|
281
|
+
expect(bid.requestId).to.equal('qwerty');
|
|
282
|
+
expect(bid.cpm).to.equal(1);
|
|
283
|
+
expect(bid.currency).to.equal('USD');
|
|
284
|
+
expect(bid.width).to.equal(300);
|
|
285
|
+
expect(bid.height).to.equal(250);
|
|
286
|
+
expect(bid.ttl).to.equal(600);
|
|
287
|
+
expect(bid.meta).to.deep.equal({ advertiserDomains: ['xe.works'] });
|
|
288
|
+
});
|
|
345
289
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
290
|
+
it('should interpret valid banner response', function () {
|
|
291
|
+
const serverResponse = {
|
|
292
|
+
body: {
|
|
293
|
+
data: [{
|
|
294
|
+
requestId: 'qwerty',
|
|
295
|
+
cpm: 1,
|
|
296
|
+
currency: 'USD',
|
|
297
|
+
width: 300,
|
|
298
|
+
height: 250,
|
|
299
|
+
ttl: 600,
|
|
300
|
+
mediaType: 'banner',
|
|
301
|
+
creativeId: 'xe-demo-banner',
|
|
302
|
+
ad: 'ad',
|
|
303
|
+
meta: {}
|
|
304
|
+
}]
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const validResponseBanner = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequest });
|
|
309
|
+
const bid = validResponseBanner[0];
|
|
310
|
+
expect(validResponseBanner).to.be.an('array').that.is.not.empty;
|
|
311
|
+
expect(bid.mediaType).to.equal('banner');
|
|
312
|
+
expect(bid.creativeId).to.equal('xe-demo-banner');
|
|
313
|
+
expect(bid.ad).to.equal('ad');
|
|
314
|
+
});
|
|
351
315
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
316
|
+
it('should interpret valid video response', function () {
|
|
317
|
+
const serverResponse = {
|
|
318
|
+
body: {
|
|
319
|
+
data: [{
|
|
320
|
+
requestId: 'qwerty',
|
|
321
|
+
cpm: 1,
|
|
322
|
+
currency: 'USD',
|
|
323
|
+
width: 600,
|
|
324
|
+
height: 480,
|
|
325
|
+
ttl: 600,
|
|
326
|
+
mediaType: 'video',
|
|
327
|
+
creativeId: 'xe-demo-video',
|
|
328
|
+
ad: 'vast-xml',
|
|
329
|
+
meta: {}
|
|
330
|
+
}]
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const validResponseBanner = spec.interpretResponse(serverResponse, { bidderRequest: defaultRequestVideo });
|
|
335
|
+
const bid = validResponseBanner[0];
|
|
336
|
+
expect(validResponseBanner).to.be.an('array').that.is.not.empty;
|
|
337
|
+
expect(bid.mediaType).to.equal('video');
|
|
338
|
+
expect(bid.creativeId).to.equal('xe-demo-video');
|
|
339
|
+
expect(bid.ad).to.equal('vast-xml');
|
|
340
|
+
});
|
|
355
341
|
});
|
|
356
342
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
ext: {
|
|
363
|
-
pixels: [
|
|
364
|
-
[ 'iframe', 'surl1?a=b' ],
|
|
365
|
-
[ 'image', 'surl2?a=b' ],
|
|
366
|
-
]
|
|
367
|
-
}
|
|
368
|
-
}]
|
|
369
|
-
}
|
|
370
|
-
}]);
|
|
371
|
-
expect(opts.length).to.equal(1);
|
|
372
|
-
expect(opts[0].type).to.equal('iframe');
|
|
373
|
-
expect(opts[0].url).to.equal('surl1?a=b&us_privacy=&gdpr=0&gdpr_consent=');
|
|
374
|
-
});
|
|
343
|
+
describe('getUserSyncs', function () {
|
|
344
|
+
it('shoukd handle no params', function () {
|
|
345
|
+
const opts = spec.getUserSyncs({}, []);
|
|
346
|
+
expect(opts).to.be.an('array').that.is.empty;
|
|
347
|
+
});
|
|
375
348
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
requestId: 'qwerty',
|
|
381
|
-
ext: {
|
|
382
|
-
pixels: [
|
|
383
|
-
[ 'iframe', 'surl1?a=b' ],
|
|
384
|
-
[ 'image', 'surl2?a=b' ],
|
|
385
|
-
]
|
|
386
|
-
}
|
|
387
|
-
}]
|
|
388
|
-
}
|
|
389
|
-
}]);
|
|
390
|
-
expect(opts.length).to.equal(1);
|
|
391
|
-
expect(opts[0].type).to.equal('image');
|
|
392
|
-
expect(opts[0].url).to.equal('surl2?a=b&us_privacy=&gdpr=0&gdpr_consent=');
|
|
393
|
-
});
|
|
349
|
+
it('should return empty if sync is not allowed', function () {
|
|
350
|
+
const opts = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: false});
|
|
351
|
+
expect(opts).to.be.an('array').that.is.empty;
|
|
352
|
+
});
|
|
394
353
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
expect(opts[0].type).to.equal('image');
|
|
414
|
-
expect(opts[0].url).to.equal('surl2?a=b&us_privacy=&gdpr=1&gdpr_consent=1YA-');
|
|
415
|
-
});
|
|
416
|
-
});
|
|
354
|
+
it('should allow iframe sync', function () {
|
|
355
|
+
const opts = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: false}, [{
|
|
356
|
+
body: {
|
|
357
|
+
data: [{
|
|
358
|
+
requestId: 'qwerty',
|
|
359
|
+
ext: {
|
|
360
|
+
pixels: [
|
|
361
|
+
[ 'iframe', 'surl1?a=b' ],
|
|
362
|
+
[ 'image', 'surl2?a=b' ],
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
}]
|
|
366
|
+
}
|
|
367
|
+
}]);
|
|
368
|
+
expect(opts.length).to.equal(1);
|
|
369
|
+
expect(opts[0].type).to.equal('iframe');
|
|
370
|
+
expect(opts[0].url).to.equal('surl1?a=b&us_privacy=&gdpr=0&gdpr_consent=');
|
|
371
|
+
});
|
|
417
372
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
373
|
+
it('should allow pixel sync', function () {
|
|
374
|
+
const opts = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [{
|
|
375
|
+
body: {
|
|
376
|
+
data: [{
|
|
377
|
+
requestId: 'qwerty',
|
|
378
|
+
ext: {
|
|
379
|
+
pixels: [
|
|
380
|
+
[ 'iframe', 'surl1?a=b' ],
|
|
381
|
+
[ 'image', 'surl2?a=b' ],
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
}]
|
|
385
|
+
}
|
|
386
|
+
}]);
|
|
387
|
+
expect(opts.length).to.equal(1);
|
|
388
|
+
expect(opts[0].type).to.equal('image');
|
|
389
|
+
expect(opts[0].url).to.equal('surl2?a=b&us_privacy=&gdpr=0&gdpr_consent=');
|
|
390
|
+
});
|
|
424
391
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
392
|
+
it('should allow pixel sync and parse consent params', function () {
|
|
393
|
+
const opts = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [{
|
|
394
|
+
body: {
|
|
395
|
+
data: [{
|
|
396
|
+
requestId: 'qwerty',
|
|
397
|
+
ext: {
|
|
398
|
+
pixels: [
|
|
399
|
+
[ 'iframe', 'surl1?a=b' ],
|
|
400
|
+
[ 'image', 'surl2?a=b' ],
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
}]
|
|
404
|
+
}
|
|
405
|
+
}], {
|
|
406
|
+
gdprApplies: 1,
|
|
407
|
+
consentString: '1YA-'
|
|
408
|
+
});
|
|
409
|
+
expect(opts.length).to.equal(1);
|
|
410
|
+
expect(opts[0].type).to.equal('image');
|
|
411
|
+
expect(opts[0].url).to.equal('surl2?a=b&us_privacy=&gdpr=1&gdpr_consent=1YA-');
|
|
412
|
+
});
|
|
429
413
|
});
|
|
430
414
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
});
|
|
415
|
+
describe('getBidFloor', function () {
|
|
416
|
+
it('should return null when getFloor is not a function', () => {
|
|
417
|
+
const bid = { getFloor: 2 };
|
|
418
|
+
const result = getBidFloor(bid);
|
|
419
|
+
expect(result).to.be.null;
|
|
420
|
+
});
|
|
438
421
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
expect(result).to.be.null;
|
|
445
|
-
});
|
|
422
|
+
it('should return null when getFloor doesnt return an object', () => {
|
|
423
|
+
const bid = { getFloor: () => 2 };
|
|
424
|
+
const result = getBidFloor(bid);
|
|
425
|
+
expect(result).to.be.null;
|
|
426
|
+
});
|
|
446
427
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
428
|
+
it('should return null when floor is not a number', () => {
|
|
429
|
+
const bid = {
|
|
430
|
+
getFloor: () => ({ floor: 'string', currency: 'USD' })
|
|
431
|
+
};
|
|
432
|
+
const result = getBidFloor(bid);
|
|
433
|
+
expect(result).to.be.null;
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
it('should return null when currency is not USD', () => {
|
|
437
|
+
const bid = {
|
|
438
|
+
getFloor: () => ({ floor: 5, currency: 'EUR' })
|
|
439
|
+
};
|
|
440
|
+
const result = getBidFloor(bid);
|
|
441
|
+
expect(result).to.be.null;
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it('should return floor value when everything is correct', () => {
|
|
445
|
+
const bid = {
|
|
446
|
+
getFloor: () => ({ floor: 5, currency: 'USD' })
|
|
447
|
+
};
|
|
448
|
+
const result = getBidFloor(bid);
|
|
449
|
+
expect(result).to.equal(5);
|
|
450
|
+
});
|
|
453
451
|
});
|
|
454
|
-
})
|
|
452
|
+
})
|