prebid.js 9.4.0 → 9.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/.eslintrc.js +31 -5
- package/.github/workflows/jscpd.yml +2 -2
- package/.github/workflows/linter.yml +107 -0
- package/creative/crossDomain.js +6 -3
- package/dist/33acrossAnalyticsAdapter.js +1 -1
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/BTBidAdapter.js +1 -1
- package/dist/adagioAnalyticsAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adagioRtdProvider.js +1 -1
- package/dist/adagioUtils.js +1 -1
- package/dist/addefendBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adkernelAdnBidAdapter.js +1 -1
- package/dist/adkernelBidAdapter.js +1 -1
- package/dist/adkernelUtils.js +1 -0
- package/dist/adlooxRtdProvider.js +1 -1
- package/dist/admixerBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adstirBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/advRedAnalyticsAdapter.js +1 -0
- package/dist/adxcgAnalyticsAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/agmaAnalyticsAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/akamaiDapRtdProvider.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/anonymisedRtdProvider.js +1 -1
- package/dist/apacdexBidAdapter.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/azerionedgeRtdProvider.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/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/chunk-core.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connatixBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/contxtfulRtdProvider.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/currencyUtils.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/dailymotionBidAdapter.js +1 -1
- package/dist/debugging-standalone.js +1 -1
- package/dist/dependencies.json +43 -7
- package/dist/dfpAdServerVideo.js +1 -1
- package/dist/dfpAdpod.js +1 -1
- package/dist/dfpUtils.js +1 -1
- package/dist/discoveryBidAdapter.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/dxkultureBidAdapter.js +1 -1
- package/dist/eightPodAnalyticsAdapter.js +1 -1
- package/dist/eightPodBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/exadsBidAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/fintezaAnalyticsAdapter.js +1 -1
- package/dist/fpdUtils.js +1 -0
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gptPreAuction.js +1 -1
- package/dist/gptUtils.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/growthCodeAnalyticsAdapter.js +1 -1
- package/dist/growthCodeRtdProvider.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5AnalyticsAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/intentIqAnalyticsAdapter.js +1 -0
- package/dist/ixBidAdapter.js +1 -1
- package/dist/jixieBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/jwplayerBidAdapter.js +1 -1
- package/dist/jwplayerRtdProvider.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/kimberliteBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.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/luceadBidAdapter.js +1 -1
- package/dist/mabidderBidAdapter.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/mediagoBidAdapter.js +1 -1
- package/dist/medianetAnalyticsAdapter.js +1 -1
- package/dist/medianetBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/missenaBidAdapter.js +1 -1
- package/dist/mobianRtdProvider.js +1 -1
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/nobidAnalyticsAdapter.js +1 -1
- package/dist/nobidBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +201 -193
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openwebBidAdapter.js +1 -1
- package/dist/openxBidAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/optoutBidAdapter.js +1 -1
- package/dist/orbidderBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/paapi.js +1 -1
- package/dist/permutiveRtdProvider.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/playdigoBidAdapter.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/programmaticaBidAdapter.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/publirBidAdapter.js +1 -1
- package/dist/pubmaticAnalyticsAdapter.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/relevatehealthBidAdapter.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/ringieraxelspringerBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/schainSerializer.js +1 -0
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/sizeMapping.js +1 -1
- package/dist/sizeUtils.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/snigelBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stnBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/symitriDapRtdProvider.js +1 -0
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/tappxBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/targetVideoUtils.js +1 -0
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/terceptAnalyticsAdapter.js +1 -1
- package/dist/themoneytizerBidAdapter.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/unrulyBidAdapter.js +1 -1
- package/dist/userAgentUtils.js +1 -0
- package/dist/utiqIdSystem.js +1 -1
- package/dist/vidazooUtils.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahooAdsBidAdapter.js +1 -1
- package/dist/yandexIdSystem.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/integrationExamples/gpt/x-domain/creative.html +1 -1
- package/libraries/adkernelUtils/adkernelUtils.js +11 -0
- package/libraries/currencyUtils/floor.js +23 -0
- package/libraries/dfpUtils/dfpUtils.js +7 -0
- package/libraries/fpdUtils/deviceInfo.js +58 -0
- package/libraries/fpdUtils/pageInfo.js +73 -0
- package/libraries/gptUtils/gptUtils.js +23 -1
- package/libraries/schainSerializer/schainSerializer.js +24 -0
- package/libraries/sizeUtils/tranformSize.js +43 -0
- package/libraries/targetVideoUtils/bidderUtils.js +178 -0
- package/libraries/targetVideoUtils/constants.js +23 -0
- package/libraries/userAgentUtils/index.js +58 -0
- package/libraries/userAgentUtils/userAgentTypes.enums.js +22 -0
- package/modules/.submodules.json +1 -0
- package/modules/33acrossAnalyticsAdapter.js +2 -0
- package/modules/adagioBidAdapter.js +1 -1
- package/modules/adagioRtdProvider.js +18 -4
- package/modules/adkernelAdnBidAdapter.js +1 -12
- package/modules/adkernelBidAdapter.js +4 -13
- package/modules/adlooxAnalyticsAdapter.js +1 -0
- package/modules/admixerBidAdapter.js +10 -6
- package/modules/admixerBidAdapter.md +7 -10
- package/modules/adtrgtmeBidAdapter.js +1 -1
- package/modules/advRedAnalyticsAdapter.js +198 -0
- package/modules/advRedAnalyticsAdapter.md +30 -0
- package/modules/akamaiDapRtdProvider.js +19 -798
- package/modules/anonymisedRtdProvider.js +5 -1
- package/modules/anonymisedRtdProvider.md +1 -1
- package/modules/apacdexBidAdapter.js +1 -1
- package/modules/appnexusBidAdapter.js +56 -2
- package/modules/automatadAnalyticsAdapter.js +2 -0
- package/modules/azerionedgeRtdProvider.js +13 -3
- package/modules/azerionedgeRtdProvider.md +0 -17
- package/modules/bridBidAdapter.js +47 -47
- package/modules/cleanioRtdProvider.js +1 -0
- package/modules/concertBidAdapter.js +1 -1
- package/modules/connatixBidAdapter.js +36 -8
- package/modules/connectIdSystem.js +3 -1
- package/modules/contxtfulRtdProvider.js +20 -2
- package/modules/contxtfulRtdProvider.md +1 -0
- package/modules/craftBidAdapter.js +1 -1
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/cwireBidAdapter.js +5 -1
- package/modules/dailymotionBidAdapter.js +85 -65
- package/modules/debugging/debugging.js +3 -0
- package/modules/dfpAdServerVideo.js +15 -33
- package/modules/dfpAdpod.js +2 -6
- package/modules/dgkeywordRtdProvider.js +2 -0
- package/modules/discoveryBidAdapter.js +26 -210
- package/modules/dspxBidAdapter.js +176 -54
- package/modules/eightPodAnalyticsAdapter.js +28 -34
- package/modules/eightPodBidAdapter.js +113 -57
- package/modules/fintezaAnalyticsAdapter.js +9 -4
- package/modules/goldbachBidAdapter.js +1 -1
- package/modules/gptPreAuction.js +63 -4
- package/modules/growthCodeAnalyticsAdapter.js +1 -1
- package/modules/growthCodeRtdProvider.js +1 -1
- package/modules/gumgumBidAdapter.js +14 -10
- package/modules/improvedigitalBidAdapter.js +1 -1
- package/modules/intentIqAnalyticsAdapter.js +234 -0
- package/modules/intentIqAnalyticsAdapter.md +27 -0
- package/modules/intentIqIdSystem.md +0 -0
- package/modules/jwplayerBidAdapter.js +1 -1
- package/modules/jwplayerRtdProvider.js +26 -6
- package/modules/jwplayerVideoProvider.js +6 -0
- package/modules/mediafuseBidAdapter.js +1 -1
- package/modules/mediagoBidAdapter.js +7 -176
- package/modules/medianetBidAdapter.js +101 -40
- package/modules/mgidBidAdapter.js +3 -1
- package/modules/mobianRtdProvider.js +16 -2
- package/modules/nextMillenniumBidAdapter.js +1 -27
- package/modules/nobidBidAdapter.js +1 -1
- package/modules/optoutBidAdapter.js +1 -1
- package/modules/paapi.js +48 -35
- package/modules/permutiveRtdProvider.js +72 -22
- package/modules/playdigoBidAdapter.js +4 -2
- package/modules/prebidServerBidAdapter/index.js +4 -2
- package/modules/prebidServerBidAdapter/ortbConverter.js +1 -0
- package/modules/programmaticaBidAdapter.js +1 -1
- package/modules/pubmaticBidAdapter.js +12 -0
- package/modules/pubxaiAnalyticsAdapter.js +306 -164
- package/modules/relevatehealthBidAdapter.js +2 -1
- package/modules/richaudienceBidAdapter.js +1 -1
- package/modules/rtdModule/index.js +5 -3
- package/modules/sirdataRtdProvider.js +2 -0
- package/modules/sizeMapping.js +2 -5
- package/modules/smaatoBidAdapter.js +18 -1
- package/modules/smilewantedBidAdapter.js +26 -22
- package/modules/snigelBidAdapter.js +1 -1
- package/modules/sonobiBidAdapter.js +5 -10
- package/modules/symitriDapRtdProvider.js +812 -0
- package/modules/symitriDapRtdProvider.md +49 -0
- package/modules/targetVideoBidAdapter.js +120 -152
- package/modules/targetVideoBidAdapter.md +20 -3
- package/modules/userId/eids.js +3 -0
- package/modules/utiqIdSystem.js +12 -10
- package/modules/validationFpdModule/index.js +22 -17
- package/modules/videojsVideoProvider.js +3 -0
- package/modules/visxBidAdapter.js +1 -1
- package/modules/winrBidAdapter.js +2 -27
- package/modules/yahooAdsBidAdapter.js +1 -1
- package/modules/yandexIdSystem.js +1 -1
- package/package.json +4 -4
- package/plugins/eslint/index.js +73 -45
- package/src/adRendering.js +7 -3
- package/src/adloader.js +1 -0
- package/src/ajax.js +15 -0
- package/src/config.js +0 -4
- package/src/debugging.js +1 -0
- package/src/secureCreatives.js +1 -1
- package/src/storageManager.js +62 -73
- package/src/targeting.js +26 -20
- package/src/utils.js +9 -0
- package/test/pages/banner_sync.html +97 -0
- package/test/pages/consent_mgt_gdpr.html +1 -1
- package/test/spec/ajax_spec.js +11 -0
- package/test/spec/creative/crossDomainCreative_spec.js +26 -9
- package/test/spec/e2e/banner/basic_banner_ad.spec.js +20 -14
- package/test/spec/fpd/gdpr_spec.js +1 -1
- package/test/spec/libraries/userAgentUtils_spec.js +109 -0
- package/test/spec/modules/adagioRtdProvider_spec.js +72 -0
- package/test/spec/modules/admixerBidAdapter_spec.js +21 -17
- package/test/spec/modules/advRedAnalyticsAdapter_spec.js +114 -0
- package/test/spec/modules/adxcgBidAdapter_spec.js +1 -1
- package/test/spec/modules/appnexusBidAdapter_spec.js +36 -0
- package/test/spec/modules/azerionedgeRtdProvider_spec.js +36 -21
- package/test/spec/modules/connatixBidAdapter_spec.js +55 -2
- package/test/spec/modules/consentManagement_spec.js +1 -1
- package/test/spec/modules/contxtfulRtdProvider_spec.js +6 -0
- package/test/spec/modules/dailymotionBidAdapter_spec.js +497 -4
- package/test/spec/modules/discoveryBidAdapter_spec.js +9 -6
- package/test/spec/modules/dspxBidAdapter_spec.js +188 -7
- package/test/spec/modules/eightPodAnalyticsAdapter_spec.js +22 -13
- package/test/spec/modules/gptPreAuction_spec.js +143 -1
- package/test/spec/modules/gumgumBidAdapter_spec.js +17 -0
- package/test/spec/modules/intentIqAnalyticsAdapter_spec.js +172 -0
- package/test/spec/modules/jwplayerRtdProvider_spec.js +61 -0
- package/test/spec/modules/mediagoBidAdapter_spec.js +34 -37
- package/test/spec/modules/medianetBidAdapter_spec.js +297 -16
- package/test/spec/modules/mgidBidAdapter_spec.js +15 -5
- package/test/spec/modules/mobianRtdProvider_spec.js +1 -3
- package/test/spec/modules/paapi_spec.js +177 -111
- package/test/spec/modules/permutiveRtdProvider_spec.js +42 -8
- package/test/spec/modules/prebidServerBidAdapter_spec.js +17 -3
- package/test/spec/modules/proxistoreBidAdapter_spec.js +1 -1
- package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +970 -603
- package/test/spec/modules/pulsepointBidAdapter_spec.js +4 -4
- package/test/spec/modules/smaatoBidAdapter_spec.js +36 -1
- package/test/spec/modules/smilewantedBidAdapter_spec.js +57 -1
- package/test/spec/modules/symitriDapRtdProvider_spec.js +600 -0
- package/test/spec/modules/targetVideoBidAdapter_spec.js +112 -11
- package/test/spec/modules/yandexIdSystem_spec.js +6 -1
- package/test/spec/schainSerializer/schainSerializer_spec.js +138 -0
- package/test/spec/unit/core/storageManager_spec.js +68 -51
- package/test/spec/utils_spec.js +19 -0
- /package/src/utils/{gpdr.js → gdpr.js} +0 -0
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
import { spec } from '../../../modules/targetVideoBidAdapter.js'
|
|
2
2
|
|
|
3
3
|
describe('TargetVideo Bid Adapter', function() {
|
|
4
|
+
const bidder = 'targetVideo';
|
|
5
|
+
const params = {
|
|
6
|
+
placementId: 12345,
|
|
7
|
+
};
|
|
8
|
+
|
|
4
9
|
const bannerRequest = [{
|
|
5
|
-
bidder
|
|
10
|
+
bidder,
|
|
11
|
+
params,
|
|
6
12
|
mediaTypes: {
|
|
7
13
|
banner: {
|
|
8
14
|
sizes: [[300, 250]],
|
|
9
15
|
}
|
|
10
16
|
},
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
}];
|
|
18
|
+
|
|
19
|
+
const videoRequest = [{
|
|
20
|
+
bidder,
|
|
21
|
+
params,
|
|
22
|
+
mediaTypes: {
|
|
23
|
+
video: {
|
|
24
|
+
playerSize: [[640, 360]],
|
|
25
|
+
context: 'instream',
|
|
26
|
+
playbackmethod: [1, 2, 3, 4]
|
|
27
|
+
}
|
|
13
28
|
}
|
|
14
29
|
}];
|
|
15
30
|
|
|
16
31
|
it('Test the bid validation function', function() {
|
|
17
|
-
const validBid = spec.isBidRequestValid(bannerRequest[0]);
|
|
32
|
+
const validBid = spec.isBidRequestValid(bannerRequest[0]) && spec.isBidRequestValid(videoRequest[0]);
|
|
18
33
|
const invalidBid = spec.isBidRequestValid(null);
|
|
19
34
|
|
|
20
35
|
expect(validBid).to.be.true;
|
|
21
36
|
expect(invalidBid).to.be.false;
|
|
22
37
|
});
|
|
23
38
|
|
|
24
|
-
it('Test the request processing function', function
|
|
39
|
+
it('Test the BANNER request processing function', function() {
|
|
25
40
|
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
|
|
26
41
|
expect(request).to.not.be.empty;
|
|
27
42
|
|
|
@@ -36,7 +51,20 @@ describe('TargetVideo Bid Adapter', function() {
|
|
|
36
51
|
expect(payload.tags[0].ad_types[0]).to.equal('video');
|
|
37
52
|
});
|
|
38
53
|
|
|
39
|
-
it('
|
|
54
|
+
it('Test the VIDEO request processing function', function() {
|
|
55
|
+
const request = spec.buildRequests(videoRequest, videoRequest[0]);
|
|
56
|
+
expect(request).to.not.be.empty;
|
|
57
|
+
|
|
58
|
+
const payload = JSON.parse(request[0].data);
|
|
59
|
+
expect(payload).to.not.be.empty;
|
|
60
|
+
expect(payload.sdk).to.deep.equal({
|
|
61
|
+
source: 'pbjs',
|
|
62
|
+
version: '$prebid.version$'
|
|
63
|
+
});
|
|
64
|
+
expect(payload.imp[0].ext.prebid.storedrequest.id).to.equal(12345);
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('Handle BANNER nobid responses', function() {
|
|
40
68
|
const responseBody = {
|
|
41
69
|
'version': '0.0.1',
|
|
42
70
|
'tags': [{
|
|
@@ -48,11 +76,24 @@ describe('TargetVideo Bid Adapter', function() {
|
|
|
48
76
|
};
|
|
49
77
|
const bidderRequest = null;
|
|
50
78
|
|
|
51
|
-
const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
|
|
79
|
+
const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
|
|
52
80
|
expect(bidResponse.length).to.equal(0);
|
|
53
81
|
});
|
|
54
82
|
|
|
55
|
-
it('
|
|
83
|
+
it('Handle VIDEO nobid responses', function() {
|
|
84
|
+
const responseBody = {
|
|
85
|
+
'id': 'test-id',
|
|
86
|
+
'cur': 'USD',
|
|
87
|
+
'seatbid': [],
|
|
88
|
+
'nbr': 0
|
|
89
|
+
};
|
|
90
|
+
const bidderRequest = null;
|
|
91
|
+
|
|
92
|
+
const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
|
|
93
|
+
expect(bidResponse.length).to.equal(0);
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('Test the BANNER response parsing function', function() {
|
|
56
97
|
const responseBody = {
|
|
57
98
|
'tags': [{
|
|
58
99
|
'uuid': '84ab500420319d',
|
|
@@ -82,7 +123,7 @@ describe('TargetVideo Bid Adapter', function() {
|
|
|
82
123
|
}]
|
|
83
124
|
};
|
|
84
125
|
|
|
85
|
-
const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
|
|
126
|
+
const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
|
|
86
127
|
expect(bidResponse).to.not.be.empty;
|
|
87
128
|
|
|
88
129
|
const bid = bidResponse[0];
|
|
@@ -94,7 +135,43 @@ describe('TargetVideo Bid Adapter', function() {
|
|
|
94
135
|
expect(bid.ad).to.include('initPlayer')
|
|
95
136
|
});
|
|
96
137
|
|
|
97
|
-
it('Test
|
|
138
|
+
it('Test the VIDEO response parsing function', function() {
|
|
139
|
+
const responseBody = {
|
|
140
|
+
'id': 'test-id',
|
|
141
|
+
'cur': 'USD',
|
|
142
|
+
'seatbid': [{
|
|
143
|
+
'bid': [{
|
|
144
|
+
'id': '5044997188309660254',
|
|
145
|
+
'price': 10,
|
|
146
|
+
'adm': 'test ad',
|
|
147
|
+
'adid': '97517771',
|
|
148
|
+
'crid': '97517771',
|
|
149
|
+
'adomain': ['domain.com'],
|
|
150
|
+
'w': 640,
|
|
151
|
+
'h': 480
|
|
152
|
+
}],
|
|
153
|
+
'seat': 'bidder'
|
|
154
|
+
}]
|
|
155
|
+
};
|
|
156
|
+
const bidderRequest = {
|
|
157
|
+
bidderCode: 'brid',
|
|
158
|
+
bidderRequestId: '22edbae2733bf6',
|
|
159
|
+
bids: videoRequest
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
|
|
163
|
+
expect(bidResponse).to.not.be.empty;
|
|
164
|
+
|
|
165
|
+
const bid = bidResponse[0];
|
|
166
|
+
expect(bid).to.not.be.empty;
|
|
167
|
+
expect(bid.ad).to.equal('test ad');
|
|
168
|
+
expect(bid.cpm).to.equal(10);
|
|
169
|
+
expect(bid.width).to.equal(640);
|
|
170
|
+
expect(bid.height).to.equal(480);
|
|
171
|
+
expect(bid.currency).to.equal('USD');
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it('Test BANNER GDPR consent information is present in the request', function() {
|
|
98
175
|
let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
|
|
99
176
|
let bidderRequest = {
|
|
100
177
|
'bidderCode': 'targetVideo',
|
|
@@ -119,7 +196,7 @@ describe('TargetVideo Bid Adapter', function() {
|
|
|
119
196
|
expect(payload.gdpr_consent.addtl_consent).to.exist.and.to.deep.equal([7, 12, 35, 62, 66, 70, 89, 93, 108]);
|
|
120
197
|
});
|
|
121
198
|
|
|
122
|
-
it('Test US Privacy string is present in the request', function() {
|
|
199
|
+
it('Test BANNER US Privacy string is present in the request', function() {
|
|
123
200
|
let consentString = '1YA-';
|
|
124
201
|
let bidderRequest = {
|
|
125
202
|
'bidderCode': 'targetVideo',
|
|
@@ -136,4 +213,28 @@ describe('TargetVideo Bid Adapter', function() {
|
|
|
136
213
|
expect(payload.us_privacy).to.exist;
|
|
137
214
|
expect(payload.us_privacy).to.exist.and.to.equal(consentString);
|
|
138
215
|
});
|
|
216
|
+
|
|
217
|
+
it('Test VIDEO GDPR and USP consents are present in the request', function() {
|
|
218
|
+
let gdprConsentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
|
|
219
|
+
let uspConsentString = '1YA-';
|
|
220
|
+
let bidderRequest = {
|
|
221
|
+
'bidderCode': 'targetVideo',
|
|
222
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
223
|
+
'timeout': 3000,
|
|
224
|
+
'uspConsent': uspConsentString,
|
|
225
|
+
'gdprConsent': {
|
|
226
|
+
consentString: gdprConsentString,
|
|
227
|
+
gdprApplies: true,
|
|
228
|
+
addtlConsent: '1~7.12.35.62.66.70.89.93.108'
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
bidderRequest.bids = videoRequest;
|
|
232
|
+
|
|
233
|
+
const request = spec.buildRequests(videoRequest, bidderRequest);
|
|
234
|
+
const payload = JSON.parse(request[0].data);
|
|
235
|
+
|
|
236
|
+
expect(payload.user.ext.consent).to.equal(gdprConsentString);
|
|
237
|
+
expect(payload.regs.ext.us_privacy).to.equal(uspConsentString);
|
|
238
|
+
expect(payload.regs.ext.gdpr).to.equal(1);
|
|
239
|
+
});
|
|
139
240
|
});
|
|
@@ -110,12 +110,17 @@ describe('YandexId module', () => {
|
|
|
110
110
|
|
|
111
111
|
describe('crypto', () => {
|
|
112
112
|
it('uses Math.random when crypto is not available', () => {
|
|
113
|
-
|
|
113
|
+
const cryptoTmp = window.crypto;
|
|
114
|
+
|
|
115
|
+
// @ts-expect-error -- Crypto is always defined in modern JS. TS yells when trying to delete non-nullable property.
|
|
116
|
+
delete window.crypto;
|
|
114
117
|
|
|
115
118
|
yandexIdSubmodule.getId(CORRECT_SUBMODULE_CONFIG);
|
|
116
119
|
|
|
117
120
|
expect(randomStub.calledOnce).to.be.true;
|
|
118
121
|
expect(getCryptoRandomValuesStub.called).to.be.false;
|
|
122
|
+
|
|
123
|
+
window.crypto = cryptoTmp;
|
|
119
124
|
});
|
|
120
125
|
|
|
121
126
|
it('uses crypto when it is available', () => {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {serializeSupplyChain} from '../../../libraries/schainSerializer/schainSerializer.js'
|
|
2
|
+
describe('serializeSupplyChain', () => {
|
|
3
|
+
describe('Single Hop - Chain Complete', () => {
|
|
4
|
+
it('should serialize a single hop chain with complete information', () => {
|
|
5
|
+
const schain = {
|
|
6
|
+
ver: '1.0',
|
|
7
|
+
complete: 1,
|
|
8
|
+
nodes: [
|
|
9
|
+
{
|
|
10
|
+
asi: 'exchange1.com',
|
|
11
|
+
sid: '1234',
|
|
12
|
+
hp: 1,
|
|
13
|
+
rid: 'bid-request-1',
|
|
14
|
+
name: 'publisher',
|
|
15
|
+
domain: 'publisher.com'
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
20
|
+
const expectedResult = '1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com';
|
|
21
|
+
expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('Single Hop - Chain Complete, optional fields missing', () => {
|
|
26
|
+
it('should serialize a single hop chain with missing optional fields', () => {
|
|
27
|
+
const schain = {
|
|
28
|
+
ver: '1.0',
|
|
29
|
+
complete: 1,
|
|
30
|
+
nodes: [
|
|
31
|
+
{
|
|
32
|
+
asi: 'exchange1.com',
|
|
33
|
+
sid: '1234',
|
|
34
|
+
hp: 1
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
39
|
+
const expectedResult = '1.0,1!exchange1.com,1234,1,,,';
|
|
40
|
+
expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('Multiple Hops - With all properties supplied', () => {
|
|
45
|
+
it('should serialize multiple hops with all properties supplied', () => {
|
|
46
|
+
const schain = {
|
|
47
|
+
ver: '1.0',
|
|
48
|
+
complete: 1,
|
|
49
|
+
nodes: [
|
|
50
|
+
{
|
|
51
|
+
asi: 'exchange1.com',
|
|
52
|
+
sid: '1234',
|
|
53
|
+
hp: 1,
|
|
54
|
+
rid: 'bid-request-1',
|
|
55
|
+
name: 'publisher',
|
|
56
|
+
domain: 'publisher.com'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
asi: 'exchange2.com',
|
|
60
|
+
sid: 'abcd',
|
|
61
|
+
hp: 1,
|
|
62
|
+
rid: 'bid-request-2',
|
|
63
|
+
name: 'intermediary',
|
|
64
|
+
domain: 'intermediary.com'
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
69
|
+
const expectedResult = '1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com!exchange2.com,abcd,1,bid-request-2,intermediary,intermediary.com';
|
|
70
|
+
expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('Multiple Hops - Chain Complete, optional fields missing', () => {
|
|
75
|
+
it('should serialize multiple hops with missing optional fields', () => {
|
|
76
|
+
const schain = {
|
|
77
|
+
ver: '1.0',
|
|
78
|
+
complete: 1,
|
|
79
|
+
nodes: [
|
|
80
|
+
{
|
|
81
|
+
asi: 'exchange1.com',
|
|
82
|
+
sid: '1234',
|
|
83
|
+
hp: 1
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
asi: 'exchange2.com',
|
|
87
|
+
sid: 'abcd',
|
|
88
|
+
hp: 1
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
93
|
+
const expectedResult = '1.0,1!exchange1.com,1234,1,,,!exchange2.com,abcd,1,,,';
|
|
94
|
+
expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('Multiple Hops Expected - Chain Incomplete', () => {
|
|
99
|
+
it('should serialize multiple hops with chain incomplete', () => {
|
|
100
|
+
const schain = {
|
|
101
|
+
ver: '1.0',
|
|
102
|
+
complete: 0,
|
|
103
|
+
nodes: [
|
|
104
|
+
{
|
|
105
|
+
asi: 'exchange2.com',
|
|
106
|
+
sid: 'abcd',
|
|
107
|
+
hp: 1
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
112
|
+
const expectedResult = '1.0,0!exchange2.com,abcd,1,,,';
|
|
113
|
+
expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('Single Hop - Chain Complete, encoded values', () => {
|
|
118
|
+
it('should serialize a single hop chain with encoded values', () => {
|
|
119
|
+
const schain = {
|
|
120
|
+
ver: '1.0',
|
|
121
|
+
complete: 1,
|
|
122
|
+
nodes: [
|
|
123
|
+
{
|
|
124
|
+
asi: 'exchange1.com',
|
|
125
|
+
sid: '1234!abcd',
|
|
126
|
+
hp: 1,
|
|
127
|
+
rid: 'bid-request-1',
|
|
128
|
+
name: 'publisher, Inc.',
|
|
129
|
+
domain: 'publisher.com'
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
|
|
134
|
+
const expectedResult = '1.0,1!exchange1.com,1234%21abcd,1,bid-request-1,publisher%2C%20Inc.,publisher.com';
|
|
135
|
+
expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -26,15 +26,15 @@ describe('storage manager', function() {
|
|
|
26
26
|
hook.ready();
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
beforeEach(function() {
|
|
29
|
+
beforeEach(function () {
|
|
30
30
|
resetData();
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
afterEach(function() {
|
|
33
|
+
afterEach(function () {
|
|
34
34
|
config.resetConfig();
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
-
it('should allow to set cookie for core modules without checking gdpr enforcements', function() {
|
|
37
|
+
it('should allow to set cookie for core modules without checking gdpr enforcements', function () {
|
|
38
38
|
const coreStorage = getCoreStorageManager();
|
|
39
39
|
let date = new Date();
|
|
40
40
|
date.setTime(date.getTime() + (24 * 60 * 60 * 1000));
|
|
@@ -43,7 +43,7 @@ describe('storage manager', function() {
|
|
|
43
43
|
expect(coreStorage.getCookie('hello')).to.equal('world');
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
it('should add done callbacks to storageCallbacks array', function() {
|
|
46
|
+
it('should add done callbacks to storageCallbacks array', function () {
|
|
47
47
|
let noop = sinon.spy();
|
|
48
48
|
const coreStorage = newStorageManager();
|
|
49
49
|
|
|
@@ -55,11 +55,15 @@ describe('storage manager', function() {
|
|
|
55
55
|
coreStorage.getDataFromLocalStorage('foo', noop);
|
|
56
56
|
coreStorage.removeDataFromLocalStorage('foo', noop);
|
|
57
57
|
coreStorage.hasLocalStorage(noop);
|
|
58
|
+
coreStorage.setDataInSessionStorage('foo', 'bar', noop);
|
|
59
|
+
coreStorage.getDataFromSessionStorage('foo', noop);
|
|
60
|
+
coreStorage.removeDataFromSessionStorage('foo', noop);
|
|
61
|
+
coreStorage.hasSessionStorage(noop);
|
|
58
62
|
|
|
59
|
-
expect(storageCallbacks.length).to.equal(
|
|
63
|
+
expect(storageCallbacks.length).to.equal(12);
|
|
60
64
|
});
|
|
61
65
|
|
|
62
|
-
it('should allow bidder to access device if gdpr enforcement module is not included', function() {
|
|
66
|
+
it('should allow bidder to access device if gdpr enforcement module is not included', function () {
|
|
63
67
|
let deviceAccessSpy = sinon.spy(utils, 'hasDeviceAccess');
|
|
64
68
|
const storage = newStorageManager();
|
|
65
69
|
storage.setCookie('foo1', 'baz1');
|
|
@@ -87,12 +91,16 @@ describe('storage manager', function() {
|
|
|
87
91
|
}));
|
|
88
92
|
});
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
['Local', 'Session'].forEach(type => {
|
|
95
|
+
describe(`${type} storage`, () => {
|
|
96
|
+
it('should deny access if activity is denied', () => {
|
|
97
|
+
isAllowed.returns(false);
|
|
98
|
+
const mgr = mkManager(MODULE_TYPE_PREBID, 'mockMod');
|
|
99
|
+
mgr[`setDataIn${type}Storage`]('testKey', 'val');
|
|
100
|
+
expect(mgr[`getDataFrom${type}Storage`]('testKey')).to.not.exist;
|
|
101
|
+
});
|
|
102
|
+
})
|
|
103
|
+
})
|
|
96
104
|
|
|
97
105
|
it('should use bidder aliases when possible', () => {
|
|
98
106
|
adapterManager.registerBidAdapter({callBids: sinon.stub(), getSpec: () => ({})}, 'mockBidder');
|
|
@@ -103,57 +111,66 @@ describe('storage manager', function() {
|
|
|
103
111
|
[ACTIVITY_PARAM_COMPONENT_NAME]: 'mockAlias'
|
|
104
112
|
}))
|
|
105
113
|
})
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
describe('localstorage forbidden access in 3rd-party context', function() {
|
|
109
|
-
let errorLogSpy;
|
|
110
|
-
let originalLocalStorage;
|
|
111
|
-
const localStorageMock = { get: () => { throw Error } };
|
|
114
|
+
});
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Object.defineProperty(window, 'localStorage', localStorageMock);
|
|
116
|
-
errorLogSpy = sinon.spy(utils, 'logError');
|
|
117
|
-
});
|
|
116
|
+
['localStorage', 'sessionStorage'].forEach(storage => {
|
|
117
|
+
const Storage = storage.charAt(0).toUpperCase() + storage.substring(1);
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
describe(`${storage} forbidden access in 3rd-party context`, function () {
|
|
120
|
+
let errorLogSpy;
|
|
121
|
+
let originalStorage;
|
|
122
|
+
const storageMock = {
|
|
123
|
+
get: () => {
|
|
124
|
+
throw Error
|
|
125
|
+
}
|
|
126
|
+
};
|
|
123
127
|
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
beforeEach(function () {
|
|
129
|
+
originalStorage = window[storage];
|
|
130
|
+
Object.defineProperty(window, storage, storageMock);
|
|
131
|
+
errorLogSpy = sinon.spy(utils, 'logError');
|
|
132
|
+
});
|
|
126
133
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
afterEach(function () {
|
|
135
|
+
Object.defineProperty(window, storage, {get: () => originalStorage});
|
|
136
|
+
errorLogSpy.restore();
|
|
137
|
+
})
|
|
130
138
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
})
|
|
139
|
+
it('should not throw if storage is not accessible when setting/getting/removing', function () {
|
|
140
|
+
const coreStorage = newStorageManager();
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
coreStorage[`setDataIn${Storage}`]('key', 'value');
|
|
143
|
+
const val = coreStorage[`getDataFrom${Storage}`]('key');
|
|
144
|
+
coreStorage[`removeDataFrom${Storage}`]('key');
|
|
138
145
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
expect(val).to.be.null;
|
|
147
|
+
sinon.assert.calledThrice(errorLogSpy);
|
|
148
|
+
});
|
|
142
149
|
});
|
|
150
|
+
});
|
|
143
151
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
['localStorage', 'sessionStorage'].forEach(storage => {
|
|
153
|
+
describe(`${storage} is enabled`, function () {
|
|
154
|
+
let store;
|
|
155
|
+
beforeEach(function () {
|
|
156
|
+
store = window[storage];
|
|
157
|
+
store.clear();
|
|
158
|
+
});
|
|
147
159
|
|
|
148
|
-
|
|
149
|
-
|
|
160
|
+
afterEach(function () {
|
|
161
|
+
store.clear();
|
|
162
|
+
})
|
|
150
163
|
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
it('should remove side-effect after checking', function () {
|
|
165
|
+
const storageMgr = newStorageManager();
|
|
153
166
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
store.setItem('unrelated', 'dummy');
|
|
168
|
+
const val = storageMgr[`${storage}IsEnabled`]();
|
|
169
|
+
|
|
170
|
+
expect(val).to.be.true;
|
|
171
|
+
expect(store.length).to.be.eq(1);
|
|
172
|
+
expect(store.getItem('unrelated')).to.be.eq('dummy');
|
|
173
|
+
});
|
|
157
174
|
});
|
|
158
175
|
});
|
|
159
176
|
|
package/test/spec/utils_spec.js
CHANGED
|
@@ -1223,6 +1223,25 @@ describe('Utils', function () {
|
|
|
1223
1223
|
expect(script.id).to.equal('newId');
|
|
1224
1224
|
});
|
|
1225
1225
|
});
|
|
1226
|
+
|
|
1227
|
+
describe('safeJSONParse', () => {
|
|
1228
|
+
it('correctly encodes valid input', () => {
|
|
1229
|
+
const jsonObj = {
|
|
1230
|
+
key1: 'val1',
|
|
1231
|
+
key2: {
|
|
1232
|
+
key3: 100,
|
|
1233
|
+
key4: true
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
const result = utils.safeJSONEncode(jsonObj);
|
|
1237
|
+
expect(result).to.equal(`{"key1":"val1","key2":{"key3":100,"key4":true}}`);
|
|
1238
|
+
});
|
|
1239
|
+
it('return empty string for stringify errors', () => {
|
|
1240
|
+
const jsonObj = {k: 2n};
|
|
1241
|
+
const result = utils.safeJSONEncode(jsonObj);
|
|
1242
|
+
expect(result).to.equal('');
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1226
1245
|
});
|
|
1227
1246
|
|
|
1228
1247
|
describe('memoize', () => {
|
|
File without changes
|