@microsoft/applicationinsights-properties-js 2.7.2-nightly.2111-09 → 2.7.2-nightly.2111-14

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.
Files changed (38) hide show
  1. package/browser/applicationinsights-properties-js.integrity.json +9 -9
  2. package/browser/applicationinsights-properties-js.js +36 -3
  3. package/browser/applicationinsights-properties-js.js.map +1 -1
  4. package/browser/applicationinsights-properties-js.min.js +2 -2
  5. package/browser/applicationinsights-properties-js.min.js.map +1 -1
  6. package/dist/applicationinsights-properties-js.d.ts +1 -1
  7. package/dist/applicationinsights-properties-js.js +36 -3
  8. package/dist/applicationinsights-properties-js.js.map +1 -1
  9. package/dist/applicationinsights-properties-js.min.js +2 -2
  10. package/dist/applicationinsights-properties-js.min.js.map +1 -1
  11. package/dist/applicationinsights-properties-js.rollup.d.ts +1 -1
  12. package/dist-esm/Context/Application.js +1 -1
  13. package/dist-esm/Context/Device.js +1 -1
  14. package/dist-esm/Context/Internal.js +2 -2
  15. package/dist-esm/Context/Internal.js.map +1 -1
  16. package/dist-esm/Context/Location.js +1 -1
  17. package/dist-esm/Context/Session.js +1 -1
  18. package/dist-esm/Context/TelemetryTrace.js +1 -1
  19. package/dist-esm/Context/User.js +1 -1
  20. package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
  21. package/dist-esm/Interfaces/ITelemetryConfig.js +1 -1
  22. package/dist-esm/PropertiesPlugin.js +1 -1
  23. package/dist-esm/TelemetryContext.js +1 -1
  24. package/dist-esm/applicationinsights-properties-js.js +1 -1
  25. package/package.json +3 -3
  26. package/src/Context/Internal.ts +1 -1
  27. package/Tests/Unit/src/SessionManager.Tests.ts +0 -375
  28. package/Tests/Unit/src/prop.tests.ts +0 -11
  29. package/Tests/Unit/src/properties.tests.ts +0 -697
  30. package/Tests/Unit/src/propertiesSize.tests.ts +0 -59
  31. package/Tests/UnitTests.html +0 -53
  32. package/Tests/tsconfig.json +0 -13
  33. package/api-extractor.json +0 -361
  34. package/applicationinsights-properties-js.build.error.log +0 -18
  35. package/applicationinsights-properties-js.build.log +0 -365
  36. package/rollup.config.js +0 -139
  37. package/temp/applicationinsights-properties-js.api.md +0 -180
  38. package/tslint.json +0 -8
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights properties plugin, 2.7.2-nightly.2111-09
2
+ * Microsoft Application Insights properties plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,10 +1,10 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
- var Version = "2.7.2-nightly.2111-09";
7
+ var Version = "2.7.2-nightly.2111-14";
8
8
  var Internal = /** @class */ (function () {
9
9
  /**
10
10
  * Constructs a new instance of the internal telemetry data class.
@@ -1 +1 @@
1
- {"version":3,"file":"Internal.js.map","sources":["Internal.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Version = \"2.7.2-nightly.2111-09\";\r\nvar Internal = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the internal telemetry data class.\r\n */\r\n function Internal(config) {\r\n this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + \"_\" : \"\") + \"javascript:\" + Version;\r\n }\r\n return Internal;\r\n}());\r\nexport { Internal };\r\n//# sourceMappingURL=Internal.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"Internal.js.map","sources":["Internal.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Version = \"2.7.2-nightly.2111-14\";\r\nvar Internal = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the internal telemetry data class.\r\n */\r\n function Internal(config) {\r\n this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + \"_\" : \"\") + \"javascript:\" + Version;\r\n }\r\n return Internal;\r\n}());\r\nexport { Internal };\r\n//# sourceMappingURL=Internal.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-09
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.2-nightly.2111-14
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-properties-js",
3
- "version": "2.7.2-nightly.2111-09",
3
+ "version": "2.7.2-nightly.2111-14",
4
4
  "description": "Microsoft Application Insights properties (Part A) plugin",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -51,8 +51,8 @@
51
51
  "dependencies": {
52
52
  "@microsoft/dynamicproto-js": "^1.1.4",
53
53
  "@microsoft/applicationinsights-shims": "2.0.0",
54
- "@microsoft/applicationinsights-core-js": "2.7.2-nightly.2111-09",
55
- "@microsoft/applicationinsights-common": "2.7.2-nightly.2111-09"
54
+ "@microsoft/applicationinsights-core-js": "2.7.2-nightly.2111-14",
55
+ "@microsoft/applicationinsights-common": "2.7.2-nightly.2111-14"
56
56
  },
57
57
  "license": "MIT",
58
58
  "publishConfig": {
@@ -4,7 +4,7 @@
4
4
  import { IInternal } from "@microsoft/applicationinsights-common";
5
5
  import { ITelemetryConfig } from "../Interfaces/ITelemetryConfig";
6
6
 
7
- const Version = "2.7.2-nightly.2111-09";
7
+ const Version = "2.7.2-nightly.2111-14";
8
8
 
9
9
  export class Internal implements IInternal {
10
10
 
@@ -1,375 +0,0 @@
1
- import { Assert, AITestClass } from "@microsoft/ai-test-framework";
2
- import { SinonStub } from 'sinon';
3
- import { AppInsightsCore, DiagnosticLogger, createCookieMgr, newId, dateNow } from "@microsoft/applicationinsights-core-js";
4
- import PropertiesPlugin from "../../../src/PropertiesPlugin";
5
- import { _SessionManager } from "../../../src/Context/Session";
6
-
7
- export class SessionManagerTests extends AITestClass {
8
- private properties: PropertiesPlugin;
9
- private core: AppInsightsCore;
10
- private _cookies: { [name: string ]: string } = {};
11
-
12
- constructor(emulateEs3: boolean) {
13
- super("SessionManagerTests", emulateEs3);
14
- }
15
-
16
- public testInitialize() {
17
- let _self = this;
18
- _self._cookies = {};
19
- _self.core = new AppInsightsCore();
20
- _self.core.logger = new DiagnosticLogger();
21
- _self.core.setCookieMgr(createCookieMgr({
22
- cookieCfg: {
23
- setCookie: (name: string, value: string) => _self._setCookie(name, value),
24
- getCookie: (name: string) => _self._getCookie(name),
25
- delCookie: (name: string) => _self._delCookie(name)
26
- }
27
- }, _self.core.logger))
28
- _self.properties = new PropertiesPlugin();
29
- }
30
-
31
- public testCleanup() {
32
- this.core = null;
33
- this.properties = null;
34
- }
35
-
36
- public registerTests() {
37
- this.addSessionManagerTests();
38
- }
39
-
40
- private _setCookie(name: string, value: string) {
41
- this._cookies[name] = value;
42
- }
43
-
44
- private _getCookie(name: string) {
45
- let cookieValue = this._cookies[name] || "";
46
- // Remove any cookie attributes added to the cookie
47
- return cookieValue.split(";")[0];
48
- }
49
-
50
- private _delCookie(name: string) {
51
- if (this._cookies.hasOwnProperty(name)) {
52
- delete this._cookies[name];
53
- }
54
- }
55
-
56
- private _getNewId(idLength?: number) {
57
- return newId(idLength);
58
- }
59
-
60
- private addSessionManagerTests() {
61
-
62
- this.testCase({
63
- name: 'Session uses name prefix for cookie storage',
64
- test: () => {
65
-
66
- var sessionPrefix = newId();
67
- var config = {
68
- namePrefix: () => sessionPrefix,
69
- sessionExpirationMs: () => undefined,
70
- sessionRenewalMs: () => undefined,
71
- cookieDomain: () => undefined
72
-
73
- };
74
- // Setup
75
- let cookie = "";
76
- const cookieStub: SinonStub = this.sandbox.stub(this.core.getCookieMgr(), 'set').callsFake((cookieName, value, maxAge, domain, path) => {
77
- cookie = cookieName;
78
- });
79
-
80
- // Act
81
- const sessionManager = new _SessionManager(config, this.core);
82
- sessionManager.update();
83
-
84
- // Test
85
- Assert.ok(cookieStub.called, 'cookie set');
86
- Assert.equal('ai_session' + sessionPrefix, cookie, 'Correct cookie name when name prefix is provided - [' + cookie + ']');
87
- }
88
- });
89
-
90
- this.testCase({
91
- name: 'Session uses sessionCookiePostfix over namePrefix for cookie storage if both are configured.',
92
- test: () => {
93
-
94
- var sessionPrefix = newId();
95
- var config = {
96
- namePrefix: () => sessionPrefix,
97
- sessionCookiePostfix: () => "testSessionCookieNamePostfix",
98
- sessionExpirationMs: () => undefined,
99
- sessionRenewalMs: () => undefined,
100
- cookieDomain: () => undefined
101
-
102
- };
103
- // Setup
104
- let cookie = "";
105
- const cookieStub: SinonStub = this.sandbox.stub(this.core.getCookieMgr(), 'set').callsFake((cookieName, value, maxAge, domain, path) => {
106
- cookie = cookieName;
107
- });
108
-
109
- // Act
110
- const sessionManager = new _SessionManager(config, this.core);
111
- sessionManager.update();
112
-
113
- // Test
114
- Assert.ok(cookieStub.called, 'cookie set');
115
- Assert.equal('ai_session' + 'testSessionCookieNamePostfix', cookie, 'Correct cookie name when session cookie postfix is provided - [' + cookie + ']');
116
- }
117
- });
118
-
119
- this.testCase({
120
- name: 'Validate Session default re-hydration within expiry period',
121
- useFakeTimers: true,
122
- test: () => {
123
- var sessionPrefix = newId();
124
- var config = {
125
- namePrefix: () => sessionPrefix,
126
- sessionExpirationMs: () => 30 * 60 * 1000,
127
- sessionRenewalMs: () => 24 * 60 * 60 * 1000,
128
- cookieDomain: () => undefined
129
- };
130
-
131
- // Simulate 100ms as when zero the cookie values are deemed to be invalid
132
- this.clock.tick(100);
133
-
134
- // Initial Session
135
- const sessionManager = new _SessionManager(config, this.core);
136
- sessionManager.update();
137
- let aiSessionValue = this._cookies['ai_session' + sessionPrefix];
138
-
139
- // Simulate 100ms
140
- this.clock.tick(100);
141
-
142
- const revisitSession = new _SessionManager(config, this.core);
143
- revisitSession.update();
144
-
145
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, by the 2nd update");
146
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same");
147
- }
148
- });
149
-
150
- this.testCase({
151
- name: 'Validate Session expiration period event when accessed',
152
- useFakeTimers: true,
153
- test: () => {
154
- var sessionPrefix = newId();
155
- var config = {
156
- namePrefix: () => sessionPrefix,
157
- sessionExpirationMs: () => 5000,
158
- sessionRenewalMs: () => 24 * 60 * 60 * 1000,
159
- cookieDomain: () => undefined
160
- };
161
-
162
- // Simulate 100ms as when zero the cookie values are deemed to be invalid
163
- this.clock.tick(100);
164
-
165
- // Initial Session
166
- const sessionManager = new _SessionManager(config, this.core);
167
- sessionManager.update();
168
- let aiSessionValue = this._cookies['ai_session' + sessionPrefix];
169
-
170
- // Simulate 2 seconds
171
- for (let lp = 0; lp < 20; lp++) {
172
- // Simulate 100ms
173
- this.clock.tick(100);
174
-
175
- const revisitSession = new _SessionManager(config, this.core);
176
- revisitSession.update();
177
-
178
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, by the " + lp + " loop");
179
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same - " + lp);
180
- }
181
-
182
-
183
- // Simulate another 2 seconds
184
- this.clock.tick(2000);
185
- let revisitSession = new _SessionManager(config, this.core);
186
- revisitSession.update();
187
-
188
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, after 4 seconds");
189
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same after 4 seconds");
190
-
191
- // Simulate 999ms
192
- this.clock.tick(999);
193
- revisitSession = new _SessionManager(config, this.core);
194
- revisitSession.update();
195
-
196
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, after 4.999 seconds");
197
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same after 4.999 seconds");
198
-
199
- // Now simulate going beyond the expiry period
200
- this.clock.tick(2);
201
- revisitSession = new _SessionManager(config, this.core);
202
- revisitSession.update();
203
-
204
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated after waiting 5 seconds");
205
- Assert.notEqual(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id have now changed after 5 seconds");
206
- }
207
- });
208
-
209
- this.testCase({
210
- name: 'Validate Session renew period event when accessed',
211
- useFakeTimers: true,
212
- test: () => {
213
- var sessionPrefix = newId();
214
- var config = {
215
- namePrefix: () => sessionPrefix,
216
- sessionExpirationMs: () => 86400000,
217
- sessionRenewalMs: () => 5000,
218
- cookieDomain: () => undefined
219
- };
220
-
221
- // Simulate 100ms as when zero the cookie values are deemed to be invalid
222
- this.clock.tick(100);
223
-
224
- // Initial Session
225
- const sessionManager = new _SessionManager(config, this.core);
226
- sessionManager.update();
227
- let aiSessionValue = this._cookies['ai_session' + sessionPrefix];
228
-
229
- // Simulate 10 seconds
230
- for (let lp = 0; lp < 100; lp++) {
231
- // Simulate 100ms
232
- this.clock.tick(100);
233
-
234
- const revisitSession = new _SessionManager(config, this.core);
235
- revisitSession.update();
236
-
237
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, by the " + lp + " loop");
238
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same - " + lp);
239
- }
240
-
241
- // Simulate another 2 seconds
242
- this.clock.tick(2000);
243
- let revisitSession = new _SessionManager(config, this.core);
244
- revisitSession.update();
245
-
246
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, after " + dateNow());
247
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same after " + dateNow());
248
-
249
- // Simulate another 2 seconds (This still should not expire the cookie value as it was last accessed only 2 seconds ago)
250
- this.clock.tick(2000);
251
- revisitSession = new _SessionManager(config, this.core);
252
- revisitSession.update();
253
-
254
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated " + dateNow());
255
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same after " + dateNow());
256
-
257
- // Now simulate going beyond the expiry period
258
- this.clock.tick(5001);
259
- revisitSession = new _SessionManager(config, this.core);
260
- revisitSession.update();
261
-
262
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated after waiting " + dateNow());
263
- Assert.notEqual(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id have now changed after " + dateNow());
264
- }
265
- });
266
-
267
- this.testCase({
268
- name: 'Validate Session default re-hydration from storage',
269
- useFakeTimers: true,
270
- test: () => {
271
- var sessionPrefix = newId();
272
- var config = {
273
- namePrefix: () => sessionPrefix,
274
- sessionExpirationMs: () => 30 * 60 * 1000,
275
- sessionRenewalMs: () => 24 * 60 * 60 * 1000,
276
- cookieDomain: () => undefined
277
- };
278
-
279
- // Simulate 100ms as when zero the cookie values are deemed to be invalid
280
- this.clock.tick(100);
281
-
282
- // Initial Session
283
- const sessionManager = new _SessionManager(config, this.core);
284
- sessionManager.update();
285
- let aiSessionValue = this._cookies['ai_session' + sessionPrefix];
286
-
287
- // Simulate 100ms
288
- this.clock.tick(100);
289
-
290
- // remove the cookie
291
- delete this._cookies['ai_session' + sessionPrefix];
292
-
293
- let revisitSession = new _SessionManager(config, this.core);
294
- revisitSession.update();
295
-
296
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, by the 2nd update");
297
- Assert.notEqual(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id's are not the same");
298
-
299
- // Backup the data to storage
300
- sessionManager.backup();
301
-
302
- // remove the cookie again so this time it should restore from storage
303
- delete this._cookies['ai_session' + sessionPrefix];
304
-
305
- revisitSession = new _SessionManager(config, this.core);
306
- revisitSession.update();
307
-
308
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, by the 2nd update");
309
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same");
310
- }
311
- });
312
-
313
- this.testCase({
314
- name: 'Validate Session expiration period event when accessed from storage',
315
- useFakeTimers: true,
316
- test: () => {
317
- var sessionPrefix = newId();
318
- var config = {
319
- namePrefix: () => sessionPrefix,
320
- sessionExpirationMs: () => 5000,
321
- sessionRenewalMs: () => 24 * 60 * 60 * 1000,
322
- cookieDomain: () => undefined
323
- };
324
-
325
- // Simulate 100ms as when zero the cookie values are deemed to be invalid
326
- this.clock.tick(100);
327
-
328
- // Initial Session
329
- const sessionManager = new _SessionManager(config, this.core);
330
- sessionManager.update();
331
- let aiSessionValue = this._cookies['ai_session' + sessionPrefix];
332
-
333
- // Backup the data to storage
334
- sessionManager.backup();
335
-
336
- // Simulate 2 seconds
337
- for (let lp = 0; lp < 20; lp++) {
338
- // remove the cookie again so this time it should restore from storage
339
- delete this._cookies['ai_session' + sessionPrefix];
340
-
341
- // Simulate 100ms
342
- this.clock.tick(100);
343
-
344
- const revisitSession = new _SessionManager(config, this.core);
345
- revisitSession.update();
346
-
347
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, by the " + lp + " loop");
348
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same - " + lp);
349
- }
350
-
351
- // remove the cookie again so this time it should restore from storage
352
- delete this._cookies['ai_session' + sessionPrefix];
353
-
354
- // Simulate another 2.999 seconds
355
- this.clock.tick(2999);
356
- let revisitSession = new _SessionManager(config, this.core);
357
- revisitSession.update();
358
-
359
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated, after 4.999 seconds");
360
- Assert.equal(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id is the same after 4.999 seconds");
361
-
362
- // remove the cookie again so this time it should restore from storage
363
- delete this._cookies['ai_session' + sessionPrefix];
364
-
365
- // Now simulate going beyond the expiry period
366
- this.clock.tick(2);
367
- revisitSession = new _SessionManager(config, this.core);
368
- revisitSession.update();
369
-
370
- Assert.notEqual(aiSessionValue, this._cookies['ai_session' + sessionPrefix], "The cookie value should have been updated after waiting 5 seconds");
371
- Assert.notEqual(sessionManager.automaticSession.id, revisitSession.automaticSession.id, "Validate session id have now changed after 5 seconds");
372
- }
373
- });
374
- }
375
- }
@@ -1,11 +0,0 @@
1
- import '@microsoft/applicationinsights-shims';
2
- import { PropertiesTests } from "./properties.tests";
3
- import { SessionManagerTests } from "./SessionManager.Tests";
4
- import { PropertiesExtensionSizeCheck } from "./propertiesSize.tests";
5
-
6
- export function runTests() {
7
- new PropertiesTests().registerTests();
8
- new SessionManagerTests(false).registerTests();
9
- new SessionManagerTests(true).registerTests();
10
- new PropertiesExtensionSizeCheck().registerTests();
11
- }