prebid.js 5.19.0 → 6.2.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/.babelrc.js +1 -10
- package/README.md +4 -2
- package/browsers.json +13 -37
- package/gulpfile.js +1 -0
- package/karma.conf.maker.js +1 -1
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/admixerBidAdapter.js +2 -1
- package/modules/adnuntiusBidAdapter.js +2 -1
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/adplusBidAdapter.js +203 -0
- package/modules/adplusBidAdapter.md +39 -0
- package/modules/adyoulikeBidAdapter.js +7 -2
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/appnexusBidAdapter.js +28 -5
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/beachfrontBidAdapter.js +14 -17
- package/modules/betweenBidAdapter.js +2 -1
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +1 -3
- package/modules/codefuelBidAdapter.md +3 -3
- package/modules/craftBidAdapter.js +5 -3
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/dchain.js +149 -0
- package/modules/dchain.md +45 -0
- package/modules/deepintentBidAdapter.js +1 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/emx_digitalBidAdapter.js +9 -1
- package/modules/engageyaBidAdapter.js +68 -54
- package/modules/freewheel-sspBidAdapter.js +6 -0
- package/modules/glimpseBidAdapter.js +31 -16
- package/modules/goldbachBidAdapter.js +1176 -0
- package/modules/goldbachBidAdapter.md +151 -0
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +5 -1
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/intersectionRtdProvider.js +114 -0
- package/modules/invibesBidAdapter.js +15 -9
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +173 -22
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/livewrappedAnalyticsAdapter.js +5 -0
- package/modules/luponmediaBidAdapter.js +570 -0
- package/modules/merkleIdSystem.js +5 -0
- package/modules/missenaBidAdapter.js +89 -0
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +32 -2
- package/modules/oguryBidAdapter.js +2 -1
- package/modules/openxBidAdapter.js +7 -2
- package/modules/operaadsBidAdapter.js +21 -1
- package/modules/otmBidAdapter.js +146 -0
- package/modules/otmBidAdapter.md +27 -26
- package/modules/outbrainBidAdapter.js +5 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/prebidServerBidAdapter/index.js +3 -3
- package/modules/pubmaticBidAdapter.js +5 -3
- package/modules/relaidoBidAdapter.js +86 -65
- package/modules/richaudienceBidAdapter.js +1 -1
- package/modules/rtdModule/index.js +2 -2
- package/modules/saambaaBidAdapter.js +420 -0
- package/modules/saambaaBidAdapter.md +65 -68
- package/modules/seedtagBidAdapter.js +6 -0
- package/modules/smaatoBidAdapter.js +9 -1
- package/modules/smartxBidAdapter.js +17 -1
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/tappxBidAdapter.js +3 -1
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/trustxBidAdapter.js +18 -7
- package/modules/undertoneBidAdapter.js +8 -1
- package/modules/userId/index.js +27 -2
- package/modules/ventes.md +71 -0
- package/modules/ventesBidAdapter.js +410 -0
- package/modules/ventesBidAdapter.md +93 -0
- package/modules/vidoomyBidAdapter.js +51 -100
- package/modules/visxBidAdapter.js +20 -3
- package/modules/visxBidAdapter.md +4 -6
- package/modules/yahoosspBidAdapter.js +6 -6
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/modules/yieldoneBidAdapter.js +115 -11
- package/package.json +6 -1
- package/src/adapterManager.js +14 -8
- package/src/auction.js +14 -13
- package/src/targeting.js +2 -2
- package/src/utils.js +7 -0
- package/test/spec/integration/faker/googletag.js +6 -0
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +18 -0
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +65 -2
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
- package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
- package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
- package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/dchain_spec.js +329 -0
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
- package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +288 -5
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/konduitWrapper_spec.js +0 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +23 -4
- package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
- package/test/spec/modules/openxBidAdapter_spec.js +5 -26
- package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
- package/test/spec/modules/otmBidAdapter_spec.js +67 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
- package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
- package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
- package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
- package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
- package/test/spec/modules/userId_spec.js +51 -0
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +121 -5
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
- package/test/spec/unit/core/adapterManager_spec.js +26 -7
- package/test/spec/unit/core/targeting_spec.js +44 -0
- package/wdio.conf.js +1 -1
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { checkDchainSyntax, addBidResponseHook } from '../../../modules/dchain.js';
|
|
2
|
+
import { config } from '../../../src/config.js';
|
|
3
|
+
import { expect } from 'chai';
|
|
4
|
+
|
|
5
|
+
describe('dchain module', function () {
|
|
6
|
+
const STRICT = 'strict';
|
|
7
|
+
const RELAX = 'relaxed';
|
|
8
|
+
const OFF = 'off';
|
|
9
|
+
|
|
10
|
+
describe('checkDchainSyntax', function () {
|
|
11
|
+
let bid;
|
|
12
|
+
|
|
13
|
+
beforeEach(function () {
|
|
14
|
+
bid = {
|
|
15
|
+
meta: {
|
|
16
|
+
dchain: {
|
|
17
|
+
'ver': '1.0',
|
|
18
|
+
'complete': 0,
|
|
19
|
+
'ext': {},
|
|
20
|
+
'nodes': [{
|
|
21
|
+
'asi': 'domain.com',
|
|
22
|
+
'bsid': '12345',
|
|
23
|
+
}, {
|
|
24
|
+
'name': 'bidder',
|
|
25
|
+
'domain': 'bidder.com',
|
|
26
|
+
'ext': {}
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('Returns false if complete param is not 0 or 1', function () {
|
|
34
|
+
let dchainConfig = bid.meta.dchain;
|
|
35
|
+
dchainConfig.complete = 0; // integer
|
|
36
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
37
|
+
dchainConfig.complete = 1; // integer
|
|
38
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
39
|
+
dchainConfig.complete = '1'; // string
|
|
40
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
41
|
+
dchainConfig.complete = 1.1; // float
|
|
42
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
43
|
+
dchainConfig.complete = {}; // object
|
|
44
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
45
|
+
delete dchainConfig.complete; // undefined
|
|
46
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
47
|
+
dchainConfig.complete = true; // boolean
|
|
48
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
49
|
+
dchainConfig.complete = []; // array
|
|
50
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('Returns false if ver param is not a String', function () {
|
|
54
|
+
let dchainConfig = bid.meta.dchain;
|
|
55
|
+
dchainConfig.ver = 1; // integer
|
|
56
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
57
|
+
dchainConfig.ver = '1'; // string
|
|
58
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
59
|
+
dchainConfig.ver = 1.1; // float
|
|
60
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
61
|
+
dchainConfig.ver = {}; // object
|
|
62
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
63
|
+
delete dchainConfig.ver; // undefined
|
|
64
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
65
|
+
dchainConfig.ver = true; // boolean
|
|
66
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
67
|
+
dchainConfig.ver = []; // array
|
|
68
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Returns false if ext param is not an Object', function () {
|
|
72
|
+
let dchainConfig = bid.meta.dchain;
|
|
73
|
+
dchainConfig.ext = 1; // integer
|
|
74
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
75
|
+
dchainConfig.ext = '1'; // string
|
|
76
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
77
|
+
dchainConfig.ext = 1.1; // float
|
|
78
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
79
|
+
dchainConfig.ext = {}; // object
|
|
80
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
81
|
+
delete dchainConfig.ext; // undefined
|
|
82
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
83
|
+
dchainConfig.ext = true; // boolean
|
|
84
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
85
|
+
dchainConfig.ext = []; // array
|
|
86
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('Returns false if nodes param is not an Array', function () {
|
|
90
|
+
let dchainConfig = bid.meta.dchain;
|
|
91
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
92
|
+
dchainConfig.nodes = 1; // integer
|
|
93
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
94
|
+
dchainConfig.nodes = '1'; // string
|
|
95
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
96
|
+
dchainConfig.nodes = 1.1; // float
|
|
97
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
98
|
+
dchainConfig.nodes = {}; // object
|
|
99
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
100
|
+
delete dchainConfig.nodes; // undefined
|
|
101
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
102
|
+
dchainConfig.nodes = true; // boolean
|
|
103
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('Returns false if unknown field is used in main dchain', function () {
|
|
107
|
+
let dchainConfig = bid.meta.dchain;
|
|
108
|
+
dchainConfig.test = '1'; // String
|
|
109
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('Returns false if nodes[].asi is not a String', function () {
|
|
113
|
+
let dchainConfig = bid.meta.dchain;
|
|
114
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
115
|
+
dchainConfig.nodes[0].asi = 1; // Integer
|
|
116
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
117
|
+
dchainConfig.nodes[0].asi = 1.1; // float
|
|
118
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
119
|
+
dchainConfig.nodes[0].asi = {}; // object
|
|
120
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
121
|
+
delete dchainConfig.nodes[0].asi; // undefined
|
|
122
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
123
|
+
dchainConfig.nodes[0].asi = true; // boolean
|
|
124
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
125
|
+
dchainConfig.nodes[0].asi = []; // array
|
|
126
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('Returns false if nodes[].bsid is not a String', function () {
|
|
130
|
+
let dchainConfig = bid.meta.dchain;
|
|
131
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
132
|
+
dchainConfig.nodes[0].bsid = 1; // Integer
|
|
133
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
134
|
+
dchainConfig.nodes[0].bsid = 1.1; // float
|
|
135
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
136
|
+
dchainConfig.nodes[0].bsid = {}; // object
|
|
137
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
138
|
+
delete dchainConfig.nodes[0].bsid; // undefined
|
|
139
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
140
|
+
dchainConfig.nodes[0].bsid = true; // boolean
|
|
141
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
142
|
+
dchainConfig.nodes[0].bsid = []; // array
|
|
143
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('Returns false if nodes[].rid is not a String', function () {
|
|
147
|
+
let dchainConfig = bid.meta.dchain;
|
|
148
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
149
|
+
dchainConfig.nodes[0].rid = 1; // Integer
|
|
150
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
151
|
+
dchainConfig.nodes[0].rid = 1.1; // float
|
|
152
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
153
|
+
dchainConfig.nodes[0].rid = {}; // object
|
|
154
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
155
|
+
delete dchainConfig.nodes[0].rid; // undefined
|
|
156
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
157
|
+
dchainConfig.nodes[0].rid = true; // boolean
|
|
158
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
159
|
+
dchainConfig.nodes[0].rid = []; // array
|
|
160
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('Returns false if nodes[].name is not a String', function () {
|
|
164
|
+
let dchainConfig = bid.meta.dchain;
|
|
165
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
166
|
+
dchainConfig.nodes[0].name = 1; // Integer
|
|
167
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
168
|
+
dchainConfig.nodes[0].name = 1.1; // float
|
|
169
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
170
|
+
dchainConfig.nodes[0].name = {}; // object
|
|
171
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
172
|
+
delete dchainConfig.nodes[0].name; // undefined
|
|
173
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
174
|
+
dchainConfig.nodes[0].name = true; // boolean
|
|
175
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
176
|
+
dchainConfig.nodes[0].name = []; // array
|
|
177
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('Returns false if nodes[].domain is not a String', function () {
|
|
181
|
+
let dchainConfig = bid.meta.dchain;
|
|
182
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
183
|
+
dchainConfig.nodes[0].domain = 1; // Integer
|
|
184
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
185
|
+
dchainConfig.nodes[0].domain = 1.1; // float
|
|
186
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
187
|
+
dchainConfig.nodes[0].domain = {}; // object
|
|
188
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
189
|
+
delete dchainConfig.nodes[0].domain; // undefined
|
|
190
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
191
|
+
dchainConfig.nodes[0].domain = true; // boolean
|
|
192
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
193
|
+
dchainConfig.nodes[0].domain = []; // array
|
|
194
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('Returns false if nodes[].ext is not an Object', function () {
|
|
198
|
+
let dchainConfig = bid.meta.dchain;
|
|
199
|
+
dchainConfig.nodes[0].ext = '1'; // String
|
|
200
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
201
|
+
dchainConfig.nodes[0].ext = 1; // Integer
|
|
202
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
203
|
+
dchainConfig.nodes[0].ext = 1.1; // float
|
|
204
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
205
|
+
dchainConfig.nodes[0].ext = {}; // object
|
|
206
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
207
|
+
delete dchainConfig.nodes[0].ext; // undefined
|
|
208
|
+
expect(checkDchainSyntax(bid, STRICT)).to.true;
|
|
209
|
+
dchainConfig.nodes[0].ext = true; // boolean
|
|
210
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
211
|
+
dchainConfig.nodes[0].ext = []; // array
|
|
212
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('Returns false if unknown field is used in nodes[]', function () {
|
|
216
|
+
let dchainConfig = bid.meta.dchain;
|
|
217
|
+
dchainConfig.nodes[0].test = '1'; // String
|
|
218
|
+
expect(checkDchainSyntax(bid, STRICT)).to.false;
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('Relaxed mode: returns true even for invalid config', function () {
|
|
222
|
+
bid.meta.dchain = {
|
|
223
|
+
ver: 1.1,
|
|
224
|
+
complete: '0',
|
|
225
|
+
nodes: [{
|
|
226
|
+
name: 'asdf',
|
|
227
|
+
domain: ['domain.com']
|
|
228
|
+
}]
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
expect(checkDchainSyntax(bid, RELAX)).to.true;
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe('addBidResponseHook', function () {
|
|
236
|
+
let bid;
|
|
237
|
+
let adUnitCode = 'adUnit1';
|
|
238
|
+
|
|
239
|
+
beforeEach(function () {
|
|
240
|
+
bid = {
|
|
241
|
+
bidderCode: 'bidderA',
|
|
242
|
+
meta: {
|
|
243
|
+
dchain: {
|
|
244
|
+
'ver': '1.0',
|
|
245
|
+
'complete': 0,
|
|
246
|
+
'ext': {},
|
|
247
|
+
'nodes': [{
|
|
248
|
+
'asi': 'domain.com',
|
|
249
|
+
'bsid': '12345',
|
|
250
|
+
}, {
|
|
251
|
+
'name': 'bidder',
|
|
252
|
+
'domain': 'bidder.com',
|
|
253
|
+
'ext': {}
|
|
254
|
+
}]
|
|
255
|
+
},
|
|
256
|
+
networkName: 'myNetworkName',
|
|
257
|
+
networkId: 8475
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
afterEach(function () {
|
|
263
|
+
config.resetConfig();
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('good strict config should append a node object to existing bid.meta.dchain object', function () {
|
|
267
|
+
function testCallback(adUnitCode, bid) {
|
|
268
|
+
expect(bid.meta.dchain).to.exist;
|
|
269
|
+
expect(bid.meta.dchain.nodes[1]).to.exist.and.to.deep.equal({
|
|
270
|
+
'name': 'bidder',
|
|
271
|
+
'domain': 'bidder.com',
|
|
272
|
+
'ext': {}
|
|
273
|
+
});
|
|
274
|
+
expect(bid.meta.dchain.nodes[2]).to.exist.and.to.deep.equal({ asi: 'bidderA' });
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
config.setConfig({ dchain: { validation: STRICT } });
|
|
278
|
+
addBidResponseHook(testCallback, adUnitCode, bid);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('bad strict config should delete the bid.meta.dchain object', function () {
|
|
282
|
+
function testCallback(adUnitCode, bid) {
|
|
283
|
+
expect(bid.meta.dchain).to.not.exist;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
config.setConfig({ dchain: { validation: STRICT } });
|
|
287
|
+
bid.meta.dchain.complete = 3;
|
|
288
|
+
addBidResponseHook(testCallback, adUnitCode, bid);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('relaxed config should allow bid.meta.dchain to proceed, even with bad values', function () {
|
|
292
|
+
function testCallback(adUnitCode, bid) {
|
|
293
|
+
expect(bid.meta.dchain).to.exist;
|
|
294
|
+
expect(bid.meta.dchain.complete).to.exist.and.to.equal(3);
|
|
295
|
+
expect(bid.meta.dchain.nodes[2]).to.exist.and.to.deep.equal({ asi: 'bidderA' });
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
config.setConfig({ dchain: { validation: RELAX } });
|
|
299
|
+
bid.meta.dchain.complete = 3;
|
|
300
|
+
addBidResponseHook(testCallback, adUnitCode, bid);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('off config should allow the bid.meta.dchain to proceed', function () {
|
|
304
|
+
// check for missing nodes
|
|
305
|
+
function testCallback(adUnitCode, bid) {
|
|
306
|
+
expect(bid.meta.dchain).to.exist;
|
|
307
|
+
expect(bid.meta.dchain.complete).to.exist.and.to.equal(0);
|
|
308
|
+
expect(bid.meta.dchain.nodes).to.exist.and.to.deep.equal({ test: 123 });
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
config.setConfig({ dchain: { validation: OFF } });
|
|
312
|
+
bid.meta.dchain.nodes = { test: 123 };
|
|
313
|
+
addBidResponseHook(testCallback, adUnitCode, bid);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it('no bidder dchain', function () {
|
|
317
|
+
function testCallback(adUnitCode, bid) {
|
|
318
|
+
expect(bid.meta.dchain).to.exist;
|
|
319
|
+
expect(bid.meta.dchain.ver).to.exist.and.to.equal('1.0');
|
|
320
|
+
expect(bid.meta.dchain.complete).to.exist.and.to.equal(0);
|
|
321
|
+
expect(bid.meta.dchain.nodes).to.exist.and.to.deep.equal([{ name: 'myNetworkName', bsid: '8475' }, { name: 'bidderA' }]);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
delete bid.meta.dchain;
|
|
325
|
+
config.setConfig({ dchain: { validation: RELAX } });
|
|
326
|
+
addBidResponseHook(testCallback, adUnitCode, bid);
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
});
|