prebid.js 7.50.0 → 7.52.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/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adhashBidAdapter.js +1 -1
- package/dist/adkernelBidAdapter.js +1 -1
- package/dist/admanBidAdapter.js +1 -1
- package/dist/adnuntiusBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adrinoBidAdapter.js +1 -1
- package/dist/adriverIdSystem.js +1 -1
- package/dist/adtelligentBidAdapter.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/allowActivities.js +1 -0
- 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/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.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/cleanioRtdProvider.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectIdSystem.js +1 -1
- package/dist/connectadBidAdapter.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/cwireBidAdapter.js +1 -1
- package/dist/dependencies.json +6 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/growthCodeRtdProvider.js +1 -0
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.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/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.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/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/minutemediaplusBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +144 -140
- package/dist/objectGuard.js +1 -0
- package/dist/oguryBidAdapter.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/oxxionAnalyticsAdapter.js +1 -0
- 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/prebidServerBidAdapter.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/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/rtdModule.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- 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/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/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.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/userId.js +1 -1
- package/dist/vidazooBidAdapter.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/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/zeta_global_sspBidAdapter.js +1 -1
- package/integrationExamples/gpt/growthcode.html +20 -9
- package/libraries/objectGuard/objectGuard.js +108 -0
- package/libraries/objectGuard/ortbGuard.js +88 -0
- package/modules/adgenerationBidAdapter.js +14 -5
- package/modules/adhashBidAdapter.js +28 -17
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admanBidAdapter.js +30 -22
- package/modules/adnuntiusBidAdapter.js +98 -79
- package/modules/adnuntiusBidAdapter.md +2 -1
- package/modules/adqueryBidAdapter.js +7 -1
- package/modules/adrinoBidAdapter.js +1 -0
- package/modules/adriverIdSystem.js +1 -1
- package/modules/adtelligentBidAdapter.js +4 -2
- package/modules/allowActivities.js +74 -0
- package/modules/appnexusBidAdapter.js +1 -0
- package/modules/cleanioRtdProvider.js +2 -4
- package/modules/connectIdSystem.js +89 -13
- package/modules/connectIdSystem.md +4 -7
- package/modules/criteoBidAdapter.js +50 -3
- package/modules/freewheel-sspBidAdapter.js +10 -2
- package/modules/gdprEnforcement.js +98 -169
- package/modules/growthCodeRtdProvider.js +131 -0
- package/modules/growthCodeRtdProvider.md +55 -0
- package/modules/gumgumBidAdapter.js +5 -0
- package/modules/ixBidAdapter.js +5 -2
- package/modules/minutemediaBidAdapter.js +13 -3
- package/modules/oxxionAnalyticsAdapter.js +212 -0
- package/modules/oxxionAnalyticsAdapter.md +33 -0
- package/modules/pairIdSystem.js +6 -6
- package/modules/prebidServerBidAdapter/index.js +7 -8
- package/modules/pubmaticBidAdapter.js +1 -0
- package/modules/riseBidAdapter.js +13 -3
- package/modules/rtbhouseBidAdapter.md +24 -0
- package/modules/rtdModule/index.js +12 -1
- package/modules/sharethroughBidAdapter.js +2 -2
- package/modules/smartadserverBidAdapter.js +5 -0
- package/modules/stvBidAdapter.js +34 -1
- package/modules/undertoneBidAdapter.js +9 -1
- package/modules/userId/index.js +69 -41
- package/modules/yahoosspBidAdapter.js +45 -3
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/zeta_global_sspBidAdapter.js +1 -0
- package/package.json +1 -1
- package/src/activities/activities.js +47 -0
- package/src/activities/activityParams.js +8 -0
- package/src/activities/modules.js +1 -1
- package/src/activities/params.js +59 -0
- package/src/activities/redactor.js +157 -0
- package/src/activities/rules.js +95 -0
- package/src/adapterManager.js +45 -8
- package/src/adloader.js +2 -1
- package/src/fpd/rootDomain.js +1 -1
- package/src/native.js +20 -4
- package/src/prebid.js +1 -1
- package/src/storageManager.js +57 -44
- package/src/userSync.js +35 -18
- package/test/spec/activities/allowActivites_spec.js +138 -0
- package/test/spec/activities/objectGuard_spec.js +144 -0
- package/test/spec/activities/ortbGuard_spec.js +140 -0
- package/test/spec/activities/params_spec.js +25 -0
- package/test/spec/activities/redactor_spec.js +296 -0
- package/test/spec/activities/rules_spec.js +135 -0
- package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -12
- package/test/spec/modules/adhashBidAdapter_spec.js +51 -1
- package/test/spec/modules/admanBidAdapter_spec.js +1 -2
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +535 -264
- package/test/spec/modules/adqueryBidAdapter_spec.js +9 -0
- package/test/spec/modules/adrinoBidAdapter_spec.js +4 -0
- package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
- package/test/spec/modules/cleanioRtdProvider_spec.js +7 -8
- package/test/spec/modules/connectIdSystem_spec.js +291 -23
- package/test/spec/modules/criteoBidAdapter_spec.js +134 -2
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +5 -2
- package/test/spec/modules/gdprEnforcement_spec.js +127 -414
- package/test/spec/modules/growthCodeRtdProvider_spec.js +127 -0
- package/test/spec/modules/gumgumBidAdapter_spec.js +14 -0
- package/test/spec/modules/ixBidAdapter_spec.js +2 -1
- package/test/spec/modules/minutemediaBidAdapter_spec.js +69 -1
- package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +324 -0
- package/test/spec/modules/pairIdSystem_spec.js +16 -3
- package/test/spec/modules/prebidServerBidAdapter_spec.js +3 -1
- package/test/spec/modules/pubmaticBidAdapter_spec.js +7 -0
- package/test/spec/modules/realTimeDataModule_spec.js +1 -1
- package/test/spec/modules/riseBidAdapter_spec.js +69 -1
- package/test/spec/modules/sharethroughBidAdapter_spec.js +1 -1
- package/test/spec/modules/smartadserverBidAdapter_spec.js +42 -0
- package/test/spec/modules/stvBidAdapter_spec.js +13 -1
- package/test/spec/modules/undertoneBidAdapter_spec.js +57 -1
- package/test/spec/modules/userId_spec.js +80 -21
- package/test/spec/modules/yahoosspBidAdapter_spec.js +103 -51
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +4 -0
- package/test/spec/native_spec.js +12 -12
- package/test/spec/unit/core/adapterManager_spec.js +181 -1
- package/test/spec/unit/core/storageManager_spec.js +76 -68
- package/test/spec/unit/pbjs_api_spec.js +15 -25
- package/test/spec/userSync_spec.js +45 -16
|
@@ -119,6 +119,15 @@ describe('adqueryBidAdapter', function () {
|
|
|
119
119
|
it('should include sizes', function () {
|
|
120
120
|
expect(rdata.sizes).not.be.null
|
|
121
121
|
})
|
|
122
|
+
|
|
123
|
+
it('should include version', function () {
|
|
124
|
+
expect(rdata.v).not.be.null
|
|
125
|
+
expect(rdata.v).equal('$prebid.version$')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('should include referrer', function () {
|
|
129
|
+
expect(rdata.bidPageUrl).not.be.null
|
|
130
|
+
})
|
|
122
131
|
})
|
|
123
132
|
|
|
124
133
|
describe('interpretResponse', function () {
|
|
@@ -81,6 +81,7 @@ describe('adrinoBidAdapter', function () {
|
|
|
81
81
|
expect(result.length).to.equal(1);
|
|
82
82
|
expect(result[0].method).to.equal('POST');
|
|
83
83
|
expect(result[0].url).to.equal('https://prd-prebid-bidder.adrino.io/bidder/bids/');
|
|
84
|
+
expect(result[0].data[0].adUnitCode).to.equal('adunit-code-2');
|
|
84
85
|
expect(result[0].data[0].bidId).to.equal('12345678901234');
|
|
85
86
|
expect(result[0].data[0].placementHash).to.equal('abcdef123456');
|
|
86
87
|
expect(result[0].data[0].referer).to.equal('http://example.com/');
|
|
@@ -135,6 +136,7 @@ describe('adrinoBidAdapter', function () {
|
|
|
135
136
|
expect(result.length).to.equal(1);
|
|
136
137
|
expect(result[0].method).to.equal('POST');
|
|
137
138
|
expect(result[0].url).to.equal('https://stg-prebid-bidder.adrino.io/bidder/bids/');
|
|
139
|
+
expect(result[0].data[0].adUnitCode).to.equal('adunit-code');
|
|
138
140
|
expect(result[0].data[0].bidId).to.equal('12345678901234');
|
|
139
141
|
expect(result[0].data[0].placementHash).to.equal('abcdef123456');
|
|
140
142
|
expect(result[0].data[0].referer).to.equal('http://example.com/');
|
|
@@ -154,6 +156,7 @@ describe('adrinoBidAdapter', function () {
|
|
|
154
156
|
expect(result.length).to.equal(1);
|
|
155
157
|
expect(result[0].method).to.equal('POST');
|
|
156
158
|
expect(result[0].url).to.equal('https://prd-prebid-bidder.adrino.io/bidder/bids/');
|
|
159
|
+
expect(result[0].data[0].adUnitCode).to.equal('adunit-code');
|
|
157
160
|
expect(result[0].data[0].bidId).to.equal('12345678901234');
|
|
158
161
|
expect(result[0].data[0].placementHash).to.equal('abcdef123456');
|
|
159
162
|
expect(result[0].data[0].referer).to.equal('http://example.com/');
|
|
@@ -173,6 +176,7 @@ describe('adrinoBidAdapter', function () {
|
|
|
173
176
|
expect(result.length).to.equal(1);
|
|
174
177
|
expect(result[0].method).to.equal('POST');
|
|
175
178
|
expect(result[0].url).to.equal('https://prd-prebid-bidder.adrino.io/bidder/bids/');
|
|
179
|
+
expect(result[0].data[0].adUnitCode).to.equal('adunit-code');
|
|
176
180
|
expect(result[0].data[0].bidId).to.equal('12345678901234');
|
|
177
181
|
expect(result[0].data[0].placementHash).to.equal('abcdef123456');
|
|
178
182
|
expect(result[0].data[0].referer).to.equal('http://example.com/');
|
|
@@ -22,6 +22,7 @@ const aliasEP = {
|
|
|
22
22
|
'ocm': 'https://ghb.cenarius.orangeclickmedia.com/v2/auction/',
|
|
23
23
|
'vidcrunchllc': 'https://ghb.platform.vidcrunch.com/v2/auction/',
|
|
24
24
|
'9dotsmedia': 'https://ghb.platform.audiodots.com/v2/auction/',
|
|
25
|
+
'copper6': 'https://ghb.app.copper6.com/v2/auction/',
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const DEFAULT_ADATPER_REQ = { bidderCode: 'adtelligent' };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { loadExternalScriptStub } from 'test/mocks/adloaderStub.js';
|
|
1
2
|
import * as utils from '../../../src/utils.js';
|
|
2
3
|
import * as hook from '../../../src/hook.js'
|
|
3
4
|
import * as events from '../../../src/events.js';
|
|
@@ -68,10 +69,8 @@ describe('clean.io RTD module', function () {
|
|
|
68
69
|
it('pageInitStepProtectPage() should insert script element', function() {
|
|
69
70
|
pageInitStepProtectPage(fakeScriptURL);
|
|
70
71
|
|
|
71
|
-
sinon.assert.calledOnce(
|
|
72
|
-
sinon.assert.calledWith(
|
|
73
|
-
sinon.assert.calledWith(insertElementStub, sinon.match(elem => elem.type === 'text/javascript'));
|
|
74
|
-
sinon.assert.calledWith(insertElementStub, sinon.match(elem => elem.src === fakeScriptURL));
|
|
72
|
+
sinon.assert.calledOnce(loadExternalScriptStub);
|
|
73
|
+
sinon.assert.calledWith(loadExternalScriptStub, fakeScriptURL, 'clean.io');
|
|
75
74
|
});
|
|
76
75
|
});
|
|
77
76
|
|
|
@@ -133,14 +132,14 @@ describe('clean.io RTD module', function () {
|
|
|
133
132
|
it('should refuse initialization with incorrect parameters', function () {
|
|
134
133
|
const { init } = getModule();
|
|
135
134
|
expect(init({ params: { cdnUrl: 'abc', protectionMode: 'full' } }, {})).to.equal(false); // too short distribution name
|
|
136
|
-
sinon.assert.notCalled(
|
|
135
|
+
sinon.assert.notCalled(loadExternalScriptStub);
|
|
137
136
|
});
|
|
138
137
|
|
|
139
|
-
it('should
|
|
138
|
+
it('should initialize in full (page) protection mode', function () {
|
|
140
139
|
const { init, onBidResponseEvent } = getModule();
|
|
141
140
|
expect(init({ params: { cdnUrl: 'https://abc1234567890.cloudfront.net/script.js', protectionMode: 'full' } }, {})).to.equal(true);
|
|
142
|
-
sinon.assert.calledOnce(
|
|
143
|
-
sinon.assert.calledWith(
|
|
141
|
+
sinon.assert.calledOnce(loadExternalScriptStub);
|
|
142
|
+
sinon.assert.calledWith(loadExternalScriptStub, 'https://abc1234567890.cloudfront.net/script.js', 'clean.io');
|
|
144
143
|
|
|
145
144
|
const fakeBidResponse = makeFakeBidResponse();
|
|
146
145
|
onBidResponseEvent(fakeBidResponse, {}, {});
|
|
@@ -2,7 +2,7 @@ import {expect} from 'chai';
|
|
|
2
2
|
import {connectIdSubmodule, storage} from 'modules/connectIdSystem.js';
|
|
3
3
|
import {server} from '../../mocks/xhr';
|
|
4
4
|
import {parseQS, parseUrl} from 'src/utils.js';
|
|
5
|
-
import {uspDataHandler} from 'src/adapterManager.js';
|
|
5
|
+
import {uspDataHandler, gppDataHandler} from 'src/adapterManager.js';
|
|
6
6
|
|
|
7
7
|
const TEST_SERVER_URL = 'http://localhost:9876/';
|
|
8
8
|
|
|
@@ -14,6 +14,10 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
14
14
|
const OVERRIDE_ENDPOINT = 'https://foo/bar';
|
|
15
15
|
const STORAGE_KEY = 'connectId';
|
|
16
16
|
const USP_DATA = '1YYY';
|
|
17
|
+
const GPP_DATA = {
|
|
18
|
+
gppString: 'gppconsent',
|
|
19
|
+
applicableSections: [6, 7]
|
|
20
|
+
};
|
|
17
21
|
|
|
18
22
|
it('should have the correct module name declared', () => {
|
|
19
23
|
expect(connectIdSubmodule.name).to.equal('connectId');
|
|
@@ -34,6 +38,7 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
34
38
|
let localStorageEnabledStub;
|
|
35
39
|
let removeLocalStorageDataStub;
|
|
36
40
|
let uspConsentDataStub;
|
|
41
|
+
let gppConsentDataStub;
|
|
37
42
|
|
|
38
43
|
let consentData;
|
|
39
44
|
beforeEach(() => {
|
|
@@ -48,10 +53,12 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
48
53
|
localStorageEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
49
54
|
removeLocalStorageDataStub = sinon.stub(storage, 'removeDataFromLocalStorage');
|
|
50
55
|
uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
|
|
56
|
+
gppConsentDataStub = sinon.stub(gppDataHandler, 'getConsentData');
|
|
51
57
|
|
|
52
58
|
cookiesEnabledStub.returns(true);
|
|
53
59
|
localStorageEnabledStub.returns(true);
|
|
54
60
|
uspConsentDataStub.returns(USP_DATA);
|
|
61
|
+
gppConsentDataStub.returns(GPP_DATA);
|
|
55
62
|
|
|
56
63
|
consentData = {
|
|
57
64
|
gdprApplies: 1,
|
|
@@ -69,6 +76,7 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
69
76
|
localStorageEnabledStub.restore();
|
|
70
77
|
removeLocalStorageDataStub.restore();
|
|
71
78
|
uspConsentDataStub.restore();
|
|
79
|
+
gppConsentDataStub.restore();
|
|
72
80
|
});
|
|
73
81
|
|
|
74
82
|
function invokeGetIdAPI(configParams, consentData) {
|
|
@@ -135,37 +143,254 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
135
143
|
}, consentData)).to.be.undefined;
|
|
136
144
|
expect(ajaxStub.callCount).to.equal(0);
|
|
137
145
|
});
|
|
138
|
-
|
|
139
|
-
it('returns undefined if the pixelId param is passed, but the he and puid param are not passed', () => {
|
|
140
|
-
expect(invokeGetIdAPI({
|
|
141
|
-
pixelId: PIXEL_ID
|
|
142
|
-
}, consentData)).to.be.undefined;
|
|
143
|
-
expect(ajaxStub.callCount).to.equal(0);
|
|
144
|
-
});
|
|
145
146
|
});
|
|
146
147
|
|
|
147
148
|
describe('with valid module configuration', () => {
|
|
148
149
|
describe('when data is in client storage', () => {
|
|
149
|
-
it('returns an object with the stored ID from cookies for valid module configuration', () => {
|
|
150
|
+
it('returns an object with the stored ID from cookies for valid module configuration and sync is done', () => {
|
|
150
151
|
const cookieData = {connectId: 'foobar'};
|
|
151
152
|
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
152
153
|
let result = invokeGetIdAPI({
|
|
153
154
|
he: HASHED_EMAIL,
|
|
154
155
|
pixelId: PIXEL_ID
|
|
155
156
|
}, consentData);
|
|
157
|
+
|
|
158
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
159
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
160
|
+
expect(typeof result.callback).to.equal('function');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('returns an object with the stored ID from cookies for valid module configuration with no user sync', () => {
|
|
164
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
165
|
+
const cookieData = {connectId: 'foobar', he: HASHED_EMAIL, lastSynced: last13Days};
|
|
166
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
167
|
+
let result = invokeGetIdAPI({
|
|
168
|
+
he: HASHED_EMAIL,
|
|
169
|
+
pixelId: PIXEL_ID
|
|
170
|
+
}, consentData);
|
|
171
|
+
|
|
172
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
173
|
+
expect(result.id.lastUsed).to.be.a('number');
|
|
174
|
+
cookieData.lastUsed = result.id.lastUsed;
|
|
175
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('returns an object with the stored ID and refreshes the storages with the new lastUsed', () => {
|
|
179
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
180
|
+
const cookieData = {connectId: 'foobar', he: HASHED_EMAIL, lastSynced: last13Days, lastUsed: 1};
|
|
181
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
182
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
183
|
+
dateNowStub.returns(20);
|
|
184
|
+
const newCookieData = Object.assign({}, cookieData, {lastUsed: 20})
|
|
185
|
+
let result = invokeGetIdAPI({
|
|
186
|
+
he: HASHED_EMAIL,
|
|
187
|
+
pixelId: PIXEL_ID
|
|
188
|
+
}, consentData);
|
|
189
|
+
dateNowStub.restore();
|
|
190
|
+
|
|
191
|
+
const expiryDelta = new Date(60 * 60 * 24 * 365 * 1000);
|
|
192
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
193
|
+
expect(setCookieStub.calledOnce).to.be.true;
|
|
194
|
+
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
195
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(newCookieData));
|
|
196
|
+
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
197
|
+
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
198
|
+
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
199
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.equal(JSON.stringify(newCookieData));
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('returns an object with the stored ID from cookies and no sync when puid stays the same', () => {
|
|
203
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
204
|
+
const cookieData = {connectId: 'foobar', puid: '123', lastSynced: last13Days};
|
|
205
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
206
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
207
|
+
dateNowStub.returns(20);
|
|
208
|
+
let result = invokeGetIdAPI({
|
|
209
|
+
puid: '123',
|
|
210
|
+
pixelId: PIXEL_ID
|
|
211
|
+
}, consentData);
|
|
212
|
+
dateNowStub.restore();
|
|
213
|
+
|
|
156
214
|
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
215
|
+
cookieData.lastUsed = 20;
|
|
157
216
|
expect(result.id).to.deep.equal(cookieData);
|
|
158
217
|
});
|
|
159
218
|
|
|
160
|
-
it('returns an object with the stored ID from
|
|
219
|
+
it('returns an object with the stored ID from cookies and syncs because of expired auto generated puid', () => {
|
|
220
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
221
|
+
const last31Days = Date.now() - (60 * 60 * 24 * 1000 * 31);
|
|
222
|
+
const cookieData = {connectId: 'foo', he: 'email', lastSynced: last13Days, puid: '9', lastUsed: last31Days};
|
|
223
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
224
|
+
let result = invokeGetIdAPI({
|
|
225
|
+
he: HASHED_EMAIL,
|
|
226
|
+
pixelId: PIXEL_ID
|
|
227
|
+
}, consentData);
|
|
228
|
+
|
|
229
|
+
delete cookieData.puid;
|
|
230
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
231
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
232
|
+
expect(typeof result.callback).to.equal('function');
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('returns an object with the stored ID from cookies and does not sync for valid auto generated puid', () => {
|
|
236
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
237
|
+
const last29Days = Date.now() - (60 * 60 * 24 * 1000 * 29);
|
|
238
|
+
const cookieData = {
|
|
239
|
+
connectId: 'foo',
|
|
240
|
+
he: HASHED_EMAIL,
|
|
241
|
+
lastSynced: last13Days,
|
|
242
|
+
puid: '9',
|
|
243
|
+
lastUsed: last29Days
|
|
244
|
+
};
|
|
245
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
246
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
247
|
+
dateNowStub.returns(20);
|
|
248
|
+
let result = invokeGetIdAPI({
|
|
249
|
+
he: HASHED_EMAIL,
|
|
250
|
+
pixelId: PIXEL_ID
|
|
251
|
+
}, consentData);
|
|
252
|
+
dateNowStub.restore();
|
|
253
|
+
|
|
254
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
255
|
+
cookieData.lastUsed = 20;
|
|
256
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('returns an object with the stored ID from localStorage for valid module configuration and sync is done', () => {
|
|
161
260
|
const localStorageData = {connectId: 'foobarbaz'};
|
|
162
261
|
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
163
262
|
let result = invokeGetIdAPI({
|
|
164
263
|
he: HASHED_EMAIL,
|
|
165
264
|
pixelId: PIXEL_ID
|
|
166
265
|
}, consentData);
|
|
167
|
-
|
|
266
|
+
|
|
267
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
168
268
|
expect(result.id).to.deep.equal(localStorageData);
|
|
269
|
+
expect(typeof result.callback).to.equal('function');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it('returns an object with the stored ID from localStorage and refreshes the cookie storage', () => {
|
|
273
|
+
const localStorageData = {connectId: 'foobarbaz'};
|
|
274
|
+
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
275
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
276
|
+
dateNowStub.returns(1);
|
|
277
|
+
let result = invokeGetIdAPI({
|
|
278
|
+
he: HASHED_EMAIL,
|
|
279
|
+
pixelId: PIXEL_ID
|
|
280
|
+
}, consentData);
|
|
281
|
+
dateNowStub.restore();
|
|
282
|
+
|
|
283
|
+
const expiryDelta = new Date(1 + 60 * 60 * 24 * 365 * 1000);
|
|
284
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
285
|
+
expect(setCookieStub.calledOnce).to.be.true;
|
|
286
|
+
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
287
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(localStorageData));
|
|
288
|
+
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('Makes an ajax GET request to the production API endpoint with stored puid when id is stale', () => {
|
|
292
|
+
const last15Days = Date.now() - (60 * 60 * 24 * 1000 * 15);
|
|
293
|
+
const last29Days = Date.now() - (60 * 60 * 24 * 1000 * 29);
|
|
294
|
+
const cookieData = {
|
|
295
|
+
connectId: 'foobar',
|
|
296
|
+
he: HASHED_EMAIL,
|
|
297
|
+
lastSynced: last15Days,
|
|
298
|
+
puid: '981',
|
|
299
|
+
lastUsed: last29Days
|
|
300
|
+
};
|
|
301
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
302
|
+
invokeGetIdAPI({
|
|
303
|
+
he: HASHED_EMAIL,
|
|
304
|
+
pixelId: PIXEL_ID
|
|
305
|
+
}, consentData);
|
|
306
|
+
|
|
307
|
+
const expectedParams = {
|
|
308
|
+
he: HASHED_EMAIL,
|
|
309
|
+
pixelId: PIXEL_ID,
|
|
310
|
+
'1p': '0',
|
|
311
|
+
gdpr: '1',
|
|
312
|
+
gdpr_consent: consentData.consentString,
|
|
313
|
+
v: '1',
|
|
314
|
+
url: TEST_SERVER_URL,
|
|
315
|
+
us_privacy: USP_DATA,
|
|
316
|
+
puid: '981',
|
|
317
|
+
gpp: GPP_DATA.gppString,
|
|
318
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
319
|
+
};
|
|
320
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
321
|
+
|
|
322
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
323
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
324
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it('Makes an ajax GET request to the production API endpoint without the stored puid after 30 days', () => {
|
|
328
|
+
const last31Days = Date.now() - (60 * 60 * 24 * 1000 * 31);
|
|
329
|
+
const cookieData = {
|
|
330
|
+
connectId: 'foobar',
|
|
331
|
+
he: HASHED_EMAIL,
|
|
332
|
+
lastSynced: last31Days,
|
|
333
|
+
puid: '981',
|
|
334
|
+
lastUsed: last31Days
|
|
335
|
+
};
|
|
336
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
337
|
+
invokeGetIdAPI({
|
|
338
|
+
he: HASHED_EMAIL,
|
|
339
|
+
pixelId: PIXEL_ID
|
|
340
|
+
}, consentData);
|
|
341
|
+
|
|
342
|
+
const expectedParams = {
|
|
343
|
+
he: HASHED_EMAIL,
|
|
344
|
+
pixelId: PIXEL_ID,
|
|
345
|
+
'1p': '0',
|
|
346
|
+
gdpr: '1',
|
|
347
|
+
gdpr_consent: consentData.consentString,
|
|
348
|
+
v: '1',
|
|
349
|
+
url: TEST_SERVER_URL,
|
|
350
|
+
us_privacy: USP_DATA,
|
|
351
|
+
gpp: GPP_DATA.gppString,
|
|
352
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
353
|
+
};
|
|
354
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
355
|
+
|
|
356
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
357
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
358
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('Makes an ajax GET request to the production API endpoint with provided puid', () => {
|
|
362
|
+
const last3Days = Date.now() - (60 * 60 * 24 * 1000 * 3);
|
|
363
|
+
const cookieData = {
|
|
364
|
+
connectId: 'foobar',
|
|
365
|
+
he: HASHED_EMAIL,
|
|
366
|
+
lastSynced: last3Days,
|
|
367
|
+
puid: '981',
|
|
368
|
+
lastUsed: last3Days
|
|
369
|
+
};
|
|
370
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
371
|
+
invokeGetIdAPI({
|
|
372
|
+
pixelId: PIXEL_ID,
|
|
373
|
+
puid: PUBLISHER_USER_ID
|
|
374
|
+
}, consentData);
|
|
375
|
+
|
|
376
|
+
const expectedParams = {
|
|
377
|
+
pixelId: PIXEL_ID,
|
|
378
|
+
puid: PUBLISHER_USER_ID,
|
|
379
|
+
he: HASHED_EMAIL,
|
|
380
|
+
'1p': '0',
|
|
381
|
+
gdpr: '1',
|
|
382
|
+
gdpr_consent: consentData.consentString,
|
|
383
|
+
v: '1',
|
|
384
|
+
url: TEST_SERVER_URL,
|
|
385
|
+
us_privacy: USP_DATA,
|
|
386
|
+
gpp: GPP_DATA.gppString,
|
|
387
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
388
|
+
};
|
|
389
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
390
|
+
|
|
391
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
392
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
393
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
169
394
|
});
|
|
170
395
|
|
|
171
396
|
it('deletes local storage data when expiry has passed', () => {
|
|
@@ -284,7 +509,9 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
284
509
|
gdpr_consent: consentData.consentString,
|
|
285
510
|
v: '1',
|
|
286
511
|
url: TEST_SERVER_URL,
|
|
287
|
-
us_privacy: USP_DATA
|
|
512
|
+
us_privacy: USP_DATA,
|
|
513
|
+
gpp: GPP_DATA.gppString,
|
|
514
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
288
515
|
};
|
|
289
516
|
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
290
517
|
|
|
@@ -307,7 +534,9 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
307
534
|
pixelId: PIXEL_ID,
|
|
308
535
|
gdpr_consent: consentData.consentString,
|
|
309
536
|
url: TEST_SERVER_URL,
|
|
310
|
-
us_privacy: USP_DATA
|
|
537
|
+
us_privacy: USP_DATA,
|
|
538
|
+
gpp: GPP_DATA.gppString,
|
|
539
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
311
540
|
};
|
|
312
541
|
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
313
542
|
|
|
@@ -332,7 +561,9 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
332
561
|
gdpr_consent: consentData.consentString,
|
|
333
562
|
v: '1',
|
|
334
563
|
url: TEST_SERVER_URL,
|
|
335
|
-
us_privacy: USP_DATA
|
|
564
|
+
us_privacy: USP_DATA,
|
|
565
|
+
gpp: GPP_DATA.gppString,
|
|
566
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
336
567
|
};
|
|
337
568
|
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
338
569
|
|
|
@@ -347,6 +578,31 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
347
578
|
endpoint: OVERRIDE_ENDPOINT
|
|
348
579
|
}, consentData);
|
|
349
580
|
|
|
581
|
+
const expectedParams = {
|
|
582
|
+
he: HASHED_EMAIL,
|
|
583
|
+
'1p': '0',
|
|
584
|
+
gdpr: '1',
|
|
585
|
+
gdpr_consent: consentData.consentString,
|
|
586
|
+
v: '1',
|
|
587
|
+
url: TEST_SERVER_URL,
|
|
588
|
+
us_privacy: USP_DATA,
|
|
589
|
+
gpp: GPP_DATA.gppString,
|
|
590
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
591
|
+
};
|
|
592
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
593
|
+
|
|
594
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${OVERRIDE_ENDPOINT}?`)).to.equal(0);
|
|
595
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
596
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
it('Makes an ajax GET request to the specified override API endpoint without GPP', () => {
|
|
600
|
+
gppConsentDataStub.returns(undefined);
|
|
601
|
+
invokeGetIdAPI({
|
|
602
|
+
he: HASHED_EMAIL,
|
|
603
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
604
|
+
}, consentData);
|
|
605
|
+
|
|
350
606
|
const expectedParams = {
|
|
351
607
|
he: HASHED_EMAIL,
|
|
352
608
|
'1p': '0',
|
|
@@ -409,12 +665,12 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
409
665
|
});
|
|
410
666
|
});
|
|
411
667
|
|
|
412
|
-
it('stores the result in client
|
|
668
|
+
it('stores the result in client both storages', () => {
|
|
413
669
|
const dateNowStub = sinon.stub(Date, 'now');
|
|
414
670
|
dateNowStub.returns(0);
|
|
415
671
|
getAjaxFnStub.restore();
|
|
416
672
|
const upsResponse = {connectid: 'foobarbaz'};
|
|
417
|
-
const expiryDelta = new Date(60 * 60 * 24 *
|
|
673
|
+
const expiryDelta = new Date(60 * 60 * 24 * 365 * 1000);
|
|
418
674
|
invokeGetIdAPI({
|
|
419
675
|
puid: PUBLISHER_USER_ID,
|
|
420
676
|
pixelId: PIXEL_ID
|
|
@@ -425,14 +681,23 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
425
681
|
{'Content-Type': 'application/json'},
|
|
426
682
|
JSON.stringify(upsResponse)
|
|
427
683
|
);
|
|
684
|
+
const storage = Object.assign({}, upsResponse, {
|
|
685
|
+
puid: PUBLISHER_USER_ID,
|
|
686
|
+
lastSynced: 0,
|
|
687
|
+
lastUsed: 0
|
|
688
|
+
});
|
|
689
|
+
dateNowStub.restore();
|
|
690
|
+
|
|
428
691
|
expect(setCookieStub.calledOnce).to.be.true;
|
|
429
692
|
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
430
|
-
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(
|
|
693
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(storage));
|
|
431
694
|
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
432
695
|
expect(setCookieStub.firstCall.args[3]).to.equal(null);
|
|
433
696
|
const cookieDomain = parseUrl(TEST_SERVER_URL).hostname;
|
|
434
697
|
expect(setCookieStub.firstCall.args[4]).to.equal(`.${cookieDomain}`);
|
|
435
|
-
|
|
698
|
+
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
699
|
+
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
700
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(JSON.stringify(storage));
|
|
436
701
|
});
|
|
437
702
|
|
|
438
703
|
it('stores the result in localStorage if cookies are not permitted', () => {
|
|
@@ -441,10 +706,12 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
441
706
|
const dateNowStub = sinon.stub(Date, 'now');
|
|
442
707
|
dateNowStub.returns(0);
|
|
443
708
|
const upsResponse = {connectid: 'barfoo'};
|
|
444
|
-
const expectedStoredData =
|
|
709
|
+
const expectedStoredData = {
|
|
445
710
|
connectid: 'barfoo',
|
|
446
|
-
|
|
447
|
-
|
|
711
|
+
puid: PUBLISHER_USER_ID,
|
|
712
|
+
lastSynced: 0,
|
|
713
|
+
lastUsed: 0
|
|
714
|
+
};
|
|
448
715
|
invokeGetIdAPI({
|
|
449
716
|
puid: PUBLISHER_USER_ID,
|
|
450
717
|
pixelId: PIXEL_ID
|
|
@@ -455,10 +722,11 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
455
722
|
{'Content-Type': 'application/json'},
|
|
456
723
|
JSON.stringify(upsResponse)
|
|
457
724
|
);
|
|
725
|
+
dateNowStub.restore();
|
|
726
|
+
|
|
458
727
|
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
459
728
|
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
460
|
-
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(expectedStoredData);
|
|
461
|
-
dateNowStub.restore();
|
|
729
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(JSON.stringify(expectedStoredData));
|
|
462
730
|
});
|
|
463
731
|
});
|
|
464
732
|
});
|