@microsoft/1ds-core-js 3.1.3 → 3.1.7

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 (84) hide show
  1. package/README.md +1 -1
  2. package/bundle/ms.core-3.1.7.gbl.js +3589 -0
  3. package/bundle/ms.core-3.1.7.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.1.7.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.1.7.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.1.7.integrity.json +46 -0
  7. package/bundle/{ms.core-test.js → ms.core-3.1.7.js} +203 -100
  8. package/bundle/ms.core-3.1.7.js.map +1 -0
  9. package/bundle/ms.core-3.1.7.min.js +7 -0
  10. package/bundle/ms.core-3.1.7.min.js.map +1 -0
  11. package/bundle/{ms.core-3.1.3.gbl.js → ms.core.gbl.js} +201 -98
  12. package/bundle/ms.core.gbl.js.map +1 -0
  13. package/bundle/ms.core.gbl.min.js +7 -0
  14. package/bundle/ms.core.gbl.min.js.map +1 -0
  15. package/bundle/ms.core.integrity.json +46 -0
  16. package/bundle/{ms.core-3.1.3.js → ms.core.js} +202 -99
  17. package/bundle/ms.core.js.map +1 -0
  18. package/bundle/ms.core.min.js +7 -0
  19. package/bundle/ms.core.min.js.map +1 -0
  20. package/dist/ms.core.js +64 -68
  21. package/dist/ms.core.js.map +1 -1
  22. package/dist/ms.core.min.js +2 -2
  23. package/dist/ms.core.min.js.map +1 -1
  24. package/dist-esm/src/AppInsightsCore.js +1 -1
  25. package/dist-esm/src/BaseCore.js +1 -1
  26. package/dist-esm/src/DataModels.d.ts +5 -2
  27. package/dist-esm/src/DataModels.js +2 -1
  28. package/dist-esm/src/DataModels.js.map +1 -1
  29. package/dist-esm/src/ESPromise.js +1 -1
  30. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  31. package/dist-esm/src/Enums.d.ts +1 -0
  32. package/dist-esm/src/Enums.js +1 -1
  33. package/dist-esm/src/Index.d.ts +4 -3
  34. package/dist-esm/src/Index.js +6 -5
  35. package/dist-esm/src/Index.js.map +1 -1
  36. package/dist-esm/src/Utils.d.ts +33 -19
  37. package/dist-esm/src/Utils.js +86 -75
  38. package/dist-esm/src/Utils.js.map +1 -1
  39. package/dist-esm/src/ValueSanitizer.js +1 -1
  40. package/package.json +6 -6
  41. package/src/DataModels.ts +5 -2
  42. package/src/Index.ts +10 -10
  43. package/src/Utils.ts +100 -84
  44. package/tsconfig.json +2 -4
  45. package/bundle/ms.core-3.1.3.gbl.js.map +0 -1
  46. package/bundle/ms.core-3.1.3.gbl.min.js +0 -7
  47. package/bundle/ms.core-3.1.3.gbl.min.js.map +0 -1
  48. package/bundle/ms.core-3.1.3.js.map +0 -1
  49. package/bundle/ms.core-3.1.3.min.js +0 -7
  50. package/bundle/ms.core-3.1.3.min.js.map +0 -1
  51. package/bundle/ms.core-test.js.map +0 -1
  52. package/bundle/ms.core-test.min.js +0 -7
  53. package/bundle/ms.core-test.min.js.map +0 -1
  54. package/dist-esm/test/CoreTest.d.ts +0 -6
  55. package/dist-esm/test/CoreTest.js +0 -105
  56. package/dist-esm/test/CoreTest.js.map +0 -1
  57. package/dist-esm/test/DynamicProtoTests.d.ts +0 -7
  58. package/dist-esm/test/DynamicProtoTests.js +0 -541
  59. package/dist-esm/test/DynamicProtoTests.js.map +0 -1
  60. package/dist-esm/test/ESPromiseSchedulerTests.d.ts +0 -6
  61. package/dist-esm/test/ESPromiseSchedulerTests.js +0 -190
  62. package/dist-esm/test/ESPromiseSchedulerTests.js.map +0 -1
  63. package/dist-esm/test/ESPromiseTests.d.ts +0 -5
  64. package/dist-esm/test/ESPromiseTests.js +0 -422
  65. package/dist-esm/test/ESPromiseTests.js.map +0 -1
  66. package/dist-esm/test/FileSizeCheckTest.d.ts +0 -5
  67. package/dist-esm/test/FileSizeCheckTest.js +0 -42
  68. package/dist-esm/test/FileSizeCheckTest.js.map +0 -1
  69. package/dist-esm/test/Index.d.ts +0 -1
  70. package/dist-esm/test/Index.js +0 -23
  71. package/dist-esm/test/Index.js.map +0 -1
  72. package/dist-esm/test/TestClass.d.ts +0 -103
  73. package/dist-esm/test/TestClass.js +0 -396
  74. package/dist-esm/test/TestClass.js.map +0 -1
  75. package/dist-esm/test/TestHelper.d.ts +0 -7
  76. package/dist-esm/test/TestHelper.js +0 -98
  77. package/dist-esm/test/TestHelper.js.map +0 -1
  78. package/dist-esm/test/UtilsTest.d.ts +0 -4
  79. package/dist-esm/test/UtilsTest.js +0 -224
  80. package/dist-esm/test/UtilsTest.js.map +0 -1
  81. package/dist-esm/test/ValueSanitizerTests.d.ts +0 -6
  82. package/dist-esm/test/ValueSanitizerTests.js +0 -331
  83. package/dist-esm/test/ValueSanitizerTests.js.map +0 -1
  84. package/src/typings/XDomainRequest.d.ts +0 -23
@@ -1,6 +0,0 @@
1
- import { TestClass } from './TestClass';
2
- export declare class CoreTest extends TestClass {
3
- private channelExtension;
4
- testInitialize(): void;
5
- registerTests(): void;
6
- }
@@ -1,105 +0,0 @@
1
- /*
2
- * 1DS JS SDK Core, 3.1.3
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- * (Microsoft Internal Only)
5
- */
6
- import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
7
- import { TestClass } from './TestClass';
8
- import { AppInsightsCore, EventLatency, FullVersionString } from '../src/Index';
9
- import { AppInsightsCore as AIInternalCore } from '@microsoft/applicationinsights-core-js';
10
- var CoreTest = /** @class */ (function (_super) {
11
- __extends(CoreTest, _super);
12
- function CoreTest() {
13
- return _super !== null && _super.apply(this, arguments) || this;
14
- }
15
- CoreTest.prototype.testInitialize = function () {
16
- // As the class is using dynamicProto we need to construct at least 1 instance
17
- // before we can override/replace any prototype method as they are not populated
18
- // until the 1st instance is created.
19
- QUnit.assert.notEqual(Object.getPrototypeOf(new AIInternalCore()).initialize, undefined, 'The prototype method must exist for the instance');
20
- QUnit.assert.notEqual(AIInternalCore.prototype.initialize, undefined, 'The prototype method must exist');
21
- this.channelExtension = {
22
- pause: function () { },
23
- resume: function () { },
24
- teardown: function () { },
25
- flush: function (async, callBack) { },
26
- processTelemetry: function (env) { },
27
- setNextPlugin: function (next) { },
28
- initialize: function (config, core, extensions) { },
29
- identifier: "testChannel",
30
- priority: 501
31
- };
32
- };
33
- CoreTest.prototype.registerTests = function () {
34
- var _this = this;
35
- this.testCase({
36
- name: "initialize test",
37
- test: function () {
38
- _this._disableDynProtoBaseFuncs(); // We need to disable the useBaseInst performance setting as the sinon spy fools the internal logic and the spy is bypassed
39
- var coreTrackSpy = _this.sandbox.spy(AIInternalCore.prototype, 'initialize');
40
- var core = new AppInsightsCore();
41
- var testPropertyStorageOverride = {
42
- setProperty: function (key, value) {
43
- },
44
- getProperty: function (key) {
45
- return 'test property';
46
- }
47
- };
48
- var config = {
49
- instrumentationKey: 'testIkey',
50
- propertyStorageOverride: testPropertyStorageOverride
51
- };
52
- core.initialize(config, [_this.channelExtension]);
53
- QUnit.assert.equal(coreTrackSpy.called, true, "Expecting AI initialize was called");
54
- var actualConfig = coreTrackSpy.getCall(0).args[0];
55
- QUnit.assert.equal(actualConfig.endpointUrl, "https://browser.events.data.microsoft.com/OneCollector/1.0/");
56
- QUnit.assert.equal(actualConfig.instrumentationKey, "testIkey");
57
- if (actualConfig.propertyStorageOverride) {
58
- QUnit.assert.ok(actualConfig.propertyStorageOverride.getProperty('testKey') === 'test property');
59
- }
60
- QUnit.assert.equal(core.getWParam(), 0);
61
- }
62
- });
63
- this.testCase({
64
- name: "track test",
65
- test: function () {
66
- _this._disableDynProtoBaseFuncs(); // We need to disable the useBaseInst performance setting as the sinon spy fools the internal logic and the spy is bypassed
67
- var coreTrackSpy = _this.sandbox.spy(AIInternalCore.prototype, 'track');
68
- var core = new AppInsightsCore();
69
- var config = {
70
- instrumentationKey: 'testIkey'
71
- };
72
- core.initialize(config, [_this.channelExtension]);
73
- var telemetryItem = {
74
- name: 'testEvent',
75
- baseType: 'testEventBaseType'
76
- };
77
- core.track(telemetryItem);
78
- QUnit.assert.equal(coreTrackSpy.called, true, "Expecting the AI Core was called");
79
- var actualEvent = coreTrackSpy.getCall(0).args[0];
80
- QUnit.assert.equal(actualEvent.name, "testEvent");
81
- QUnit.assert.equal(actualEvent.latency, EventLatency.Normal);
82
- QUnit.assert.ok(actualEvent.ext['sdk']['ver'].indexOf('1DS-Web-JS') > -1);
83
- QUnit.assert.equal(actualEvent.ext['sdk']['ver'], FullVersionString, actualEvent.ext['sdk']['ver']);
84
- QUnit.assert.equal(isNaN(actualEvent.timings.trackStart), false);
85
- }
86
- });
87
- this.testCase({
88
- name: "Check inheritence implementation",
89
- test: function () {
90
- var core1 = new AppInsightsCore();
91
- var core2 = new AppInsightsCore();
92
- // Make sure the 2 initialize methods are actually different function instances
93
- QUnit.assert.ok(!core1.hasOwnProperty("initialize"), "initialize should not be an instance function");
94
- QUnit.assert.ok(!core2.hasOwnProperty("initialize"), "initialize should not be an instance function");
95
- QUnit.assert.equal(core1.initialize, core2.initialize, "initialize function should be the same (i.e. prototype based methods)");
96
- QUnit.assert.ok(!core1.hasOwnProperty("track"), "track should not be an instance function");
97
- QUnit.assert.ok(!core2.hasOwnProperty("track"), "track should not be an instance function");
98
- QUnit.assert.equal(core1.track, core2.track, "track function should be the same (i.e. prototype based methods)");
99
- }
100
- });
101
- };
102
- return CoreTest;
103
- }(TestClass));
104
- export { CoreTest };
105
- //# sourceMappingURL=CoreTest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreTest.js.map","sources":["CoreTest.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\nimport { TestClass } from './TestClass';\r\nimport { AppInsightsCore, EventLatency, FullVersionString } from '../src/Index';\r\nimport { AppInsightsCore as AIInternalCore } from '@microsoft/applicationinsights-core-js';\r\nvar CoreTest = /** @class */ (function (_super) {\r\n __extends(CoreTest, _super);\r\n function CoreTest() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n CoreTest.prototype.testInitialize = function () {\r\n // As the class is using dynamicProto we need to construct at least 1 instance\r\n // before we can override/replace any prototype method as they are not populated\r\n // until the 1st instance is created.\r\n QUnit.assert.notEqual(Object.getPrototypeOf(new AIInternalCore()).initialize, undefined, 'The prototype method must exist for the instance');\r\n QUnit.assert.notEqual(AIInternalCore.prototype.initialize, undefined, 'The prototype method must exist');\r\n this.channelExtension = {\r\n pause: function () { },\r\n resume: function () { },\r\n teardown: function () { },\r\n flush: function (async, callBack) { },\r\n processTelemetry: function (env) { },\r\n setNextPlugin: function (next) { },\r\n initialize: function (config, core, extensions) { },\r\n identifier: \"testChannel\",\r\n priority: 501\r\n };\r\n };\r\n CoreTest.prototype.registerTests = function () {\r\n var _this = this;\r\n this.testCase({\r\n name: \"initialize test\",\r\n test: function () {\r\n _this._disableDynProtoBaseFuncs(); // We need to disable the useBaseInst performance setting as the sinon spy fools the internal logic and the spy is bypassed\r\n var coreTrackSpy = _this.sandbox.spy(AIInternalCore.prototype, 'initialize');\r\n var core = new AppInsightsCore();\r\n var testPropertyStorageOverride = {\r\n setProperty: function (key, value) {\r\n },\r\n getProperty: function (key) {\r\n return 'test property';\r\n }\r\n };\r\n var config = {\r\n instrumentationKey: 'testIkey',\r\n propertyStorageOverride: testPropertyStorageOverride\r\n };\r\n core.initialize(config, [_this.channelExtension]);\r\n QUnit.assert.equal(coreTrackSpy.called, true, \"Expecting AI initialize was called\");\r\n var actualConfig = coreTrackSpy.getCall(0).args[0];\r\n QUnit.assert.equal(actualConfig.endpointUrl, \"https://browser.events.data.microsoft.com/OneCollector/1.0/\");\r\n QUnit.assert.equal(actualConfig.instrumentationKey, \"testIkey\");\r\n if (actualConfig.propertyStorageOverride) {\r\n QUnit.assert.ok(actualConfig.propertyStorageOverride.getProperty('testKey') === 'test property');\r\n }\r\n QUnit.assert.equal(core.getWParam(), 0);\r\n }\r\n });\r\n this.testCase({\r\n name: \"track test\",\r\n test: function () {\r\n _this._disableDynProtoBaseFuncs(); // We need to disable the useBaseInst performance setting as the sinon spy fools the internal logic and the spy is bypassed\r\n var coreTrackSpy = _this.sandbox.spy(AIInternalCore.prototype, 'track');\r\n var core = new AppInsightsCore();\r\n var config = {\r\n instrumentationKey: 'testIkey'\r\n };\r\n core.initialize(config, [_this.channelExtension]);\r\n var telemetryItem = {\r\n name: 'testEvent',\r\n baseType: 'testEventBaseType'\r\n };\r\n core.track(telemetryItem);\r\n QUnit.assert.equal(coreTrackSpy.called, true, \"Expecting the AI Core was called\");\r\n var actualEvent = coreTrackSpy.getCall(0).args[0];\r\n QUnit.assert.equal(actualEvent.name, \"testEvent\");\r\n QUnit.assert.equal(actualEvent.latency, EventLatency.Normal);\r\n QUnit.assert.ok(actualEvent.ext['sdk']['ver'].indexOf('1DS-Web-JS') > -1);\r\n QUnit.assert.equal(actualEvent.ext['sdk']['ver'], FullVersionString, actualEvent.ext['sdk']['ver']);\r\n QUnit.assert.equal(isNaN(actualEvent.timings.trackStart), false);\r\n }\r\n });\r\n this.testCase({\r\n name: \"Check inheritence implementation\",\r\n test: function () {\r\n var core1 = new AppInsightsCore();\r\n var core2 = new AppInsightsCore();\r\n // Make sure the 2 initialize methods are actually different function instances\r\n QUnit.assert.ok(!core1.hasOwnProperty(\"initialize\"), \"initialize should not be an instance function\");\r\n QUnit.assert.ok(!core2.hasOwnProperty(\"initialize\"), \"initialize should not be an instance function\");\r\n QUnit.assert.equal(core1.initialize, core2.initialize, \"initialize function should be the same (i.e. prototype based methods)\");\r\n QUnit.assert.ok(!core1.hasOwnProperty(\"track\"), \"track should not be an instance function\");\r\n QUnit.assert.ok(!core2.hasOwnProperty(\"track\"), \"track should not be an instance function\");\r\n QUnit.assert.equal(core1.track, core2.track, \"track function should be the same (i.e. prototype based methods)\");\r\n }\r\n });\r\n };\r\n return CoreTest;\r\n}(TestClass));\r\nexport { CoreTest };\r\n//# sourceMappingURL=CoreTest.js.map"],"names":[],"mappings":";;;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,7 +0,0 @@
1
- import { TestClass } from './TestClass';
2
- export declare class DynamicProtoTests extends TestClass {
3
- testInitialize(): void;
4
- private _validateOrder;
5
- private doTest;
6
- registerTests(): void;
7
- }
@@ -1,541 +0,0 @@
1
- /*
2
- * 1DS JS SDK Core, 3.1.3
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- * (Microsoft Internal Only)
5
- */
6
- import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
7
- import { TestClass } from './TestClass';
8
- import dynamicProto from '@microsoft/dynamicproto-js';
9
- var InheritTest1 = /** @class */ (function () {
10
- function InheritTest1() {
11
- this.executionOrder = [];
12
- this.executionOrder.push("InheritTest1()");
13
- }
14
- InheritTest1.prototype.testFunction = function () {
15
- this.executionOrder.push("InheritTest1.test()");
16
- };
17
- return InheritTest1;
18
- }());
19
- var InheritTest2 = /** @class */ (function (_super) {
20
- __extends(InheritTest2, _super);
21
- function InheritTest2() {
22
- var _this = _super.call(this) || this;
23
- _this.executionOrder.push("InheritTest2()");
24
- return _this;
25
- }
26
- InheritTest2.prototype.testFunction = function () {
27
- _super.prototype.testFunction.call(this);
28
- this.executionOrder.push("InheritTest2.test()");
29
- };
30
- return InheritTest2;
31
- }(InheritTest1));
32
- var InheritTest3 = /** @class */ (function (_super) {
33
- __extends(InheritTest3, _super);
34
- function InheritTest3() {
35
- var _this = _super.call(this) || this;
36
- _this.executionOrder.push("InheritTest3()");
37
- return _this;
38
- }
39
- InheritTest3.prototype.testFunction = function () {
40
- _super.prototype.testFunction.call(this);
41
- this.executionOrder.push("InheritTest3.test()");
42
- };
43
- return InheritTest3;
44
- }(InheritTest2));
45
- var DynInheritTest1 = /** @class */ (function () {
46
- function DynInheritTest1() {
47
- var _this = this;
48
- this.executionOrder = [];
49
- this.executionOrder.push("DynInheritTest1()");
50
- dynamicProto(DynInheritTest1, this, function (_self, base) {
51
- _self.testFunction = function () {
52
- _this.executionOrder.push("DynInheritTest1.test()");
53
- };
54
- });
55
- }
56
- return DynInheritTest1;
57
- }());
58
- var InheritTest4 = /** @class */ (function (_super) {
59
- __extends(InheritTest4, _super);
60
- function InheritTest4() {
61
- var _this = _super.call(this) || this;
62
- _this.executionOrder.push("InheritTest4()");
63
- return _this;
64
- }
65
- InheritTest4.prototype.testFunction = function () {
66
- _super.prototype.testFunction.call(this);
67
- this.executionOrder.push("InheritTest4.test()");
68
- };
69
- return InheritTest4;
70
- }(DynInheritTest1));
71
- var InheritTest5 = /** @class */ (function (_super) {
72
- __extends(InheritTest5, _super);
73
- function InheritTest5() {
74
- var _this = _super.call(this) || this;
75
- _this.executionOrder.push("InheritTest5()");
76
- return _this;
77
- }
78
- InheritTest5.prototype.testFunction = function () {
79
- _super.prototype.testFunction.call(this);
80
- this.executionOrder.push("InheritTest5.test()");
81
- };
82
- return InheritTest5;
83
- }(InheritTest4));
84
- var DynInheritTest2 = /** @class */ (function (_super) {
85
- __extends(DynInheritTest2, _super);
86
- function DynInheritTest2() {
87
- var _this = _super.call(this) || this;
88
- _this.executionOrder.push("DynInheritTest2()");
89
- dynamicProto(DynInheritTest2, _this, function (_self, base) {
90
- _self.testFunction = function () {
91
- base.testFunction();
92
- _this.executionOrder.push("DynInheritTest2.test()");
93
- };
94
- });
95
- return _this;
96
- }
97
- return DynInheritTest2;
98
- }(InheritTest1));
99
- var DynInheritTest3 = /** @class */ (function (_super) {
100
- __extends(DynInheritTest3, _super);
101
- function DynInheritTest3() {
102
- var _this = _super.call(this) || this;
103
- _this.executionOrder.push("DynInheritTest3()");
104
- dynamicProto(DynInheritTest3, _this, function (_self, base) {
105
- _self.testFunction = function () {
106
- base.testFunction();
107
- _this.executionOrder.push("DynInheritTest3.test()");
108
- };
109
- });
110
- return _this;
111
- }
112
- return DynInheritTest3;
113
- }(DynInheritTest2));
114
- var InheritTest6 = /** @class */ (function (_super) {
115
- __extends(InheritTest6, _super);
116
- function InheritTest6() {
117
- var _this = _super.call(this) || this;
118
- _this.executionOrder.push("InheritTest6()");
119
- return _this;
120
- }
121
- InheritTest6.prototype.testFunction = function () {
122
- _super.prototype.testFunction.call(this);
123
- this.executionOrder.push("InheritTest6.test()");
124
- };
125
- return InheritTest6;
126
- }(DynInheritTest2));
127
- var DynInheritTest4 = /** @class */ (function (_super) {
128
- __extends(DynInheritTest4, _super);
129
- function DynInheritTest4() {
130
- var _this = _super.call(this) || this;
131
- _this.executionOrder.push("DynInheritTest4()");
132
- dynamicProto(DynInheritTest4, _this, function (_self, base) {
133
- _self.testFunction = function () {
134
- base.testFunction();
135
- _this.executionOrder.push("DynInheritTest4.test()");
136
- };
137
- });
138
- return _this;
139
- }
140
- return DynInheritTest4;
141
- }(InheritTest6));
142
- var DynInheritTest5 = /** @class */ (function (_super) {
143
- __extends(DynInheritTest5, _super);
144
- function DynInheritTest5() {
145
- var _this = _super.call(this) || this;
146
- _this.executionOrder.push("DynInheritTest5()");
147
- dynamicProto(DynInheritTest5, _this, function (_self, base) {
148
- _self.testFunction = function () {
149
- base.testFunction();
150
- _this.executionOrder.push("DynInheritTest5.test()");
151
- };
152
- });
153
- return _this;
154
- }
155
- return DynInheritTest5;
156
- }(DynInheritTest1));
157
- var DynInheritTest6 = /** @class */ (function (_super) {
158
- __extends(DynInheritTest6, _super);
159
- function DynInheritTest6() {
160
- var _this = _super.call(this) || this;
161
- _this.executionOrder.push("DynInheritTest6()");
162
- dynamicProto(DynInheritTest6, _this, function (_self, base) {
163
- _self.testFunction = function () {
164
- base.testFunction();
165
- _this.executionOrder.push("DynInheritTest6.test()");
166
- };
167
- });
168
- return _this;
169
- }
170
- return DynInheritTest6;
171
- }(DynInheritTest5));
172
- var InstInherit1 = /** @class */ (function () {
173
- function InstInherit1() {
174
- var _this = this;
175
- this.executionOrder = [];
176
- this.executionOrder.push("InstInherit1()");
177
- this.testFunction = function () {
178
- _this.executionOrder.push("InstInherit1.test()");
179
- };
180
- }
181
- return InstInherit1;
182
- }());
183
- var InstInherit2 = /** @class */ (function (_super) {
184
- __extends(InstInherit2, _super);
185
- function InstInherit2() {
186
- var _this = _super.call(this) || this;
187
- _this.executionOrder.push("InstInherit2()");
188
- _this.testFunction = function () {
189
- _super.prototype.testFunction.call(_this);
190
- _this.executionOrder.push("InstInherit2.test()");
191
- };
192
- return _this;
193
- }
194
- return InstInherit2;
195
- }(InheritTest2));
196
- var InheritTest7 = /** @class */ (function (_super) {
197
- __extends(InheritTest7, _super);
198
- function InheritTest7() {
199
- var _this = _super.call(this) || this;
200
- _this.executionOrder.push("InheritTest7()");
201
- return _this;
202
- }
203
- InheritTest7.prototype.testFunction = function () {
204
- _super.prototype.testFunction.call(this);
205
- this.executionOrder.push("InheritTest7.test()");
206
- };
207
- return InheritTest7;
208
- }(InstInherit1));
209
- var DynInheritTest7 = /** @class */ (function (_super) {
210
- __extends(DynInheritTest7, _super);
211
- function DynInheritTest7() {
212
- var _this = _super.call(this) || this;
213
- _this.executionOrder.push("DynInheritTest7()");
214
- dynamicProto(DynInheritTest7, _this, function (_self, base) {
215
- _self.testFunction = function () {
216
- base.testFunction();
217
- _this.executionOrder.push("DynInheritTest7.test()");
218
- };
219
- });
220
- return _this;
221
- }
222
- return DynInheritTest7;
223
- }(InstInherit1));
224
- var InstInherit3 = /** @class */ (function (_super) {
225
- __extends(InstInherit3, _super);
226
- function InstInherit3() {
227
- var _this = _super.call(this) || this;
228
- _this.executionOrder.push("InstInherit3()");
229
- _this.testFunction = function () {
230
- _super.prototype.testFunction.call(_this);
231
- _this.executionOrder.push("InstInherit3.test()");
232
- };
233
- return _this;
234
- }
235
- return InstInherit3;
236
- }(DynInheritTest7));
237
- var DynInheritTest8 = /** @class */ (function (_super) {
238
- __extends(DynInheritTest8, _super);
239
- function DynInheritTest8() {
240
- var _this = _super.call(this) || this;
241
- _this.executionOrder.push("DynInheritTest8()");
242
- dynamicProto(DynInheritTest8, _this, function (_self, base) {
243
- _self.testFunction = function () {
244
- base.testFunction();
245
- _this.executionOrder.push("DynInheritTest8.test()");
246
- };
247
- });
248
- return _this;
249
- }
250
- return DynInheritTest8;
251
- }(InstInherit3));
252
- var BadInstInherit1 = /** @class */ (function (_super) {
253
- __extends(BadInstInherit1, _super);
254
- function BadInstInherit1() {
255
- var _this = _super.call(this) || this;
256
- _this.executionOrder.push("BadInstInherit1()");
257
- _this.testFunction = function () {
258
- try {
259
- _super.prototype.testFunction.call(_this);
260
- }
261
- catch (e) {
262
- _this.executionOrder.push("BadInstInherit1.throw()");
263
- }
264
- _this.executionOrder.push("BadInstInherit1.test()");
265
- };
266
- return _this;
267
- }
268
- return BadInstInherit1;
269
- }(InstInherit1));
270
- var DynInheritTest9 = /** @class */ (function (_super) {
271
- __extends(DynInheritTest9, _super);
272
- function DynInheritTest9() {
273
- var _this = _super.call(this) || this;
274
- _this.executionOrder.push("DynInheritTest9()");
275
- dynamicProto(DynInheritTest9, _this, function (_self, base) {
276
- _self.testFunction = function () {
277
- base.testFunction();
278
- _this.executionOrder.push("DynInheritTest9.test()");
279
- };
280
- });
281
- return _this;
282
- }
283
- return DynInheritTest9;
284
- }(BadInstInherit1));
285
- var GoodInstInherit1 = /** @class */ (function (_super) {
286
- __extends(GoodInstInherit1, _super);
287
- function GoodInstInherit1() {
288
- var _this = _super.call(this) || this;
289
- _this.executionOrder.push("GoodInstInherit1()");
290
- var prevTestFunc = _this.testFunction;
291
- _this.testFunction = function () {
292
- prevTestFunc.call(_this);
293
- _this.executionOrder.push("GoodInstInherit1.test()");
294
- };
295
- return _this;
296
- }
297
- return GoodInstInherit1;
298
- }(InstInherit1));
299
- var DynInheritTest10 = /** @class */ (function (_super) {
300
- __extends(DynInheritTest10, _super);
301
- function DynInheritTest10() {
302
- var _this = _super.call(this) || this;
303
- _this.executionOrder.push("DynInheritTest10()");
304
- dynamicProto(DynInheritTest10, _this, function (_self, base) {
305
- _self.testFunction = function () {
306
- base.testFunction();
307
- _this.executionOrder.push("DynInheritTest10.test()");
308
- };
309
- });
310
- return _this;
311
- }
312
- return DynInheritTest10;
313
- }(GoodInstInherit1));
314
- var GoodInstInherit2 = /** @class */ (function (_super) {
315
- __extends(GoodInstInherit2, _super);
316
- function GoodInstInherit2() {
317
- var _this = _super.call(this) || this;
318
- _this.executionOrder.push("GoodInstInherit2()");
319
- var prevTestFunc = _this.testFunction;
320
- _this.testFunction = function () {
321
- prevTestFunc.call(_this);
322
- _this.executionOrder.push("GoodInstInherit2.test()");
323
- };
324
- return _this;
325
- }
326
- return GoodInstInherit2;
327
- }(DynInheritTest10));
328
- var DynamicProtoTests = /** @class */ (function (_super) {
329
- __extends(DynamicProtoTests, _super);
330
- function DynamicProtoTests() {
331
- return _super !== null && _super.apply(this, arguments) || this;
332
- }
333
- DynamicProtoTests.prototype.testInitialize = function () {
334
- };
335
- DynamicProtoTests.prototype._validateOrder = function (message, actual, expected) {
336
- QUnit.assert.equal(actual.length, expected.length, message + ": Checking the length");
337
- var passed = true;
338
- var error = "";
339
- for (var lp = 0; lp < expected.length; lp++) {
340
- if (lp < actual.length) {
341
- if (actual[lp] !== expected[lp]) {
342
- passed = false;
343
- error += " **[" + actual[lp] + "!=" + expected[lp] + "]**;";
344
- }
345
- else {
346
- error += " " + expected[lp] + ";";
347
- }
348
- }
349
- else {
350
- passed = false;
351
- error += " --[" + expected[lp] + "]--;";
352
- }
353
- }
354
- // Fail test and log any extra unexpected calls
355
- for (var lp = expected.length; lp < actual.length; lp++) {
356
- passed = false;
357
- error += " ++[" + actual[lp] + "]++;";
358
- }
359
- QUnit.assert.ok(passed, message + ":" + error);
360
- };
361
- DynamicProtoTests.prototype.doTest = function (message, theTest, expectedOrder) {
362
- theTest.testFunction();
363
- this._validateOrder(message, theTest.executionOrder, expectedOrder);
364
- };
365
- DynamicProtoTests.prototype.registerTests = function () {
366
- var _this = this;
367
- this.testCase({
368
- name: "Inheritance tests",
369
- test: function () {
370
- _this.doTest("InheritTest1", new InheritTest1(), [
371
- "InheritTest1()",
372
- "InheritTest1.test()"
373
- ]);
374
- _this.doTest("InheritTest2", new InheritTest2(), [
375
- "InheritTest1()",
376
- "InheritTest2()",
377
- "InheritTest1.test()",
378
- "InheritTest2.test()"
379
- ]);
380
- _this.doTest("InheritTest3", new InheritTest3(), [
381
- "InheritTest1()",
382
- "InheritTest2()",
383
- "InheritTest3()",
384
- "InheritTest1.test()",
385
- "InheritTest2.test()",
386
- "InheritTest3.test()"
387
- ]);
388
- _this.doTest("InheritTest4", new InheritTest4(), [
389
- "DynInheritTest1()",
390
- "InheritTest4()",
391
- "DynInheritTest1.test()",
392
- "InheritTest4.test()"
393
- ]);
394
- _this.doTest("InheritTest5", new InheritTest5(), [
395
- "DynInheritTest1()",
396
- "InheritTest4()",
397
- "InheritTest5()",
398
- "DynInheritTest1.test()",
399
- "InheritTest4.test()",
400
- "InheritTest5.test()"
401
- ]);
402
- _this.doTest("DynInheritTest1", new DynInheritTest1(), [
403
- "DynInheritTest1()",
404
- "DynInheritTest1.test()"
405
- ]);
406
- _this.doTest("DynInheritTest2", new DynInheritTest2(), [
407
- "InheritTest1()",
408
- "DynInheritTest2()",
409
- "InheritTest1.test()",
410
- "DynInheritTest2.test()"
411
- ]);
412
- _this.doTest("DynInheritTest3", new DynInheritTest3(), [
413
- "InheritTest1()",
414
- "DynInheritTest2()",
415
- "DynInheritTest3()",
416
- "InheritTest1.test()",
417
- "DynInheritTest2.test()",
418
- "DynInheritTest3.test()"
419
- ]);
420
- _this.doTest("InheritTest6", new InheritTest6(), [
421
- "InheritTest1()",
422
- "DynInheritTest2()",
423
- "InheritTest6()",
424
- "InheritTest1.test()",
425
- "DynInheritTest2.test()",
426
- "InheritTest6.test()"
427
- ]);
428
- _this.doTest("DynInheritTest4", new DynInheritTest4(), [
429
- "InheritTest1()",
430
- "DynInheritTest2()",
431
- "InheritTest6()",
432
- "DynInheritTest4()",
433
- "InheritTest1.test()",
434
- "DynInheritTest2.test()",
435
- "InheritTest6.test()",
436
- "DynInheritTest4.test()"
437
- ]);
438
- _this.doTest("DynInheritTest5", new DynInheritTest5(), [
439
- "DynInheritTest1()",
440
- "DynInheritTest5()",
441
- "DynInheritTest1.test()",
442
- "DynInheritTest5.test()"
443
- ]);
444
- _this.doTest("DynInheritTest6", new DynInheritTest6(), [
445
- "DynInheritTest1()",
446
- "DynInheritTest5()",
447
- "DynInheritTest6()",
448
- "DynInheritTest1.test()",
449
- "DynInheritTest5.test()",
450
- "DynInheritTest6.test()"
451
- ]);
452
- _this.doTest("InstInherit1", new InstInherit1(), [
453
- "InstInherit1()",
454
- "InstInherit1.test()"
455
- ]);
456
- _this.doTest("InstInherit2", new InstInherit2(), [
457
- "InheritTest1()",
458
- "InheritTest2()",
459
- "InstInherit2()",
460
- "InheritTest1.test()",
461
- "InheritTest2.test()",
462
- "InstInherit2.test()"
463
- ]);
464
- // NOTE: Notice that InheritTest7.test() was not called -- this is because TS doesn't handle this
465
- _this.doTest("InheritTest7", new InheritTest7(), [
466
- "InstInherit1()",
467
- "InheritTest7()",
468
- "InstInherit1.test()"
469
- ]);
470
- // NOTE: Notice that DynInheritTest7.test() IS called -- this is because dynamicProto handles this scenario
471
- _this.doTest("DynInheritTest7", new DynInheritTest7(), [
472
- "InstInherit1()",
473
- "DynInheritTest7()",
474
- "InstInherit1.test()",
475
- "DynInheritTest7.test()"
476
- ]);
477
- _this.doTest("InstInherit3", new InstInherit3(), [
478
- "InstInherit1()",
479
- "DynInheritTest7()",
480
- "InstInherit3()",
481
- "InstInherit1.test()",
482
- "DynInheritTest7.test()",
483
- "InstInherit3.test()"
484
- ]);
485
- _this.doTest("DynInheritTest8", new DynInheritTest8(), [
486
- "InstInherit1()",
487
- "DynInheritTest7()",
488
- "InstInherit3()",
489
- "DynInheritTest8()",
490
- "InstInherit1.test()",
491
- "DynInheritTest7.test()",
492
- "InstInherit3.test()",
493
- "DynInheritTest8.test()"
494
- ]);
495
- // Note: Bad inherit as with InheritTest7 fails to call base instance and actually throws in this case
496
- _this.doTest("BadInstInherit1", new BadInstInherit1(), [
497
- "InstInherit1()",
498
- "BadInstInherit1()",
499
- "BadInstInherit1.throw()",
500
- "BadInstInherit1.test()"
501
- ]);
502
- // Note: dynamicProto doesn't fix broken base classes, but it still calls them in the correct order
503
- _this.doTest("DynInheritTest9", new DynInheritTest9(), [
504
- "InstInherit1()",
505
- "BadInstInherit1()",
506
- "DynInheritTest9()",
507
- "BadInstInherit1.throw()",
508
- "BadInstInherit1.test()",
509
- "DynInheritTest9.test()"
510
- ]);
511
- _this.doTest("GoodInstInherit1", new GoodInstInherit1(), [
512
- "InstInherit1()",
513
- "GoodInstInherit1()",
514
- "InstInherit1.test()",
515
- "GoodInstInherit1.test()"
516
- ]);
517
- _this.doTest("DynInheritTest10", new DynInheritTest10(), [
518
- "InstInherit1()",
519
- "GoodInstInherit1()",
520
- "DynInheritTest10()",
521
- "InstInherit1.test()",
522
- "GoodInstInherit1.test()",
523
- "DynInheritTest10.test()"
524
- ]);
525
- _this.doTest("GoodInstInherit2", new GoodInstInherit2(), [
526
- "InstInherit1()",
527
- "GoodInstInherit1()",
528
- "DynInheritTest10()",
529
- "GoodInstInherit2()",
530
- "InstInherit1.test()",
531
- "GoodInstInherit1.test()",
532
- "DynInheritTest10.test()",
533
- "GoodInstInherit2.test()",
534
- ]);
535
- }
536
- });
537
- };
538
- return DynamicProtoTests;
539
- }(TestClass));
540
- export { DynamicProtoTests };
541
- //# sourceMappingURL=DynamicProtoTests.js.map