@fluid-experimental/property-common 0.49.0 → 0.50.0-41540
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/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/chronometer.d.ts +55 -0
- package/lib/chronometer.d.ts.map +1 -0
- package/lib/chronometer.js +185 -0
- package/lib/chronometer.js.map +1 -0
- package/lib/consoleUtils.d.ts +16 -0
- package/lib/consoleUtils.d.ts.map +1 -0
- package/lib/consoleUtils.js +20 -0
- package/lib/consoleUtils.js.map +1 -0
- package/lib/constants.d.ts +1219 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +1274 -0
- package/lib/constants.js.map +1 -0
- package/lib/datastructures/collection.d.ts +203 -0
- package/lib/datastructures/collection.d.ts.map +1 -0
- package/lib/datastructures/collection.js +377 -0
- package/lib/datastructures/collection.js.map +1 -0
- package/lib/datastructures/dataArray.d.ts +275 -0
- package/lib/datastructures/dataArray.d.ts.map +1 -0
- package/lib/datastructures/dataArray.js +497 -0
- package/lib/datastructures/dataArray.js.map +1 -0
- package/lib/datastructures/index.d.ts +9 -0
- package/lib/datastructures/index.d.ts.map +1 -0
- package/lib/datastructures/index.js +9 -0
- package/lib/datastructures/index.js.map +1 -0
- package/lib/datastructures/integer64.d.ts +47 -0
- package/lib/datastructures/integer64.d.ts.map +1 -0
- package/lib/datastructures/integer64.js +140 -0
- package/lib/datastructures/integer64.js.map +1 -0
- package/lib/datastructures/sortedCollection.d.ts +77 -0
- package/lib/datastructures/sortedCollection.d.ts.map +1 -0
- package/lib/datastructures/sortedCollection.js +140 -0
- package/lib/datastructures/sortedCollection.js.map +1 -0
- package/lib/deferredPromise.d.ts +28 -0
- package/lib/deferredPromise.d.ts.map +1 -0
- package/lib/deferredPromise.js +43 -0
- package/lib/deferredPromise.js.map +1 -0
- package/lib/deterministicRandomGenerator.d.ts +39 -0
- package/lib/deterministicRandomGenerator.d.ts.map +1 -0
- package/lib/deterministicRandomGenerator.js +83 -0
- package/lib/deterministicRandomGenerator.js.map +1 -0
- package/lib/error_objects/flaggedError.d.ts +29 -0
- package/lib/error_objects/flaggedError.d.ts.map +1 -0
- package/lib/error_objects/flaggedError.js +45 -0
- package/lib/error_objects/flaggedError.js.map +1 -0
- package/lib/error_objects/httpError.d.ts +31 -0
- package/lib/error_objects/httpError.d.ts.map +1 -0
- package/lib/error_objects/httpError.js +58 -0
- package/lib/error_objects/httpError.js.map +1 -0
- package/lib/error_objects/httpErrorNoStack.d.ts +25 -0
- package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -0
- package/lib/error_objects/httpErrorNoStack.js +29 -0
- package/lib/error_objects/httpErrorNoStack.js.map +1 -0
- package/lib/error_objects/index.d.ts +9 -0
- package/lib/error_objects/index.d.ts.map +1 -0
- package/lib/error_objects/index.js +9 -0
- package/lib/error_objects/index.js.map +1 -0
- package/lib/error_objects/operationError.d.ts +32 -0
- package/lib/error_objects/operationError.d.ts.map +1 -0
- package/lib/error_objects/operationError.js +73 -0
- package/lib/error_objects/operationError.js.map +1 -0
- package/lib/guidUtils.d.ts +16 -0
- package/lib/guidUtils.d.ts.map +1 -0
- package/lib/guidUtils.js +297 -0
- package/lib/guidUtils.js.map +1 -0
- package/lib/hashCalculator.d.ts +6 -0
- package/lib/hashCalculator.d.ts.map +1 -0
- package/lib/hashCalculator.js +14 -0
- package/lib/hashCalculator.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/joinPaths.d.ts +19 -0
- package/lib/joinPaths.d.ts.map +1 -0
- package/lib/joinPaths.js +28 -0
- package/lib/joinPaths.js.map +1 -0
- package/lib/packageVersion.d.ts +9 -0
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/packageVersion.js +9 -0
- package/lib/packageVersion.js.map +1 -0
- package/package.json +22 -2
- package/platform-dependent/package.json +1 -1
- package/src/constants.ts +5 -0
- package/src/packageVersion.ts +1 -1
- package/dist/test/chronometer.spec.js +0 -90
- package/dist/test/chronometer.spec.js.map +0 -1
- package/dist/test/datastructures/collection.spec.js +0 -401
- package/dist/test/datastructures/collection.spec.js.map +0 -1
- package/dist/test/datastructures/dataArray.spec.js +0 -79
- package/dist/test/datastructures/dataArray.spec.js.map +0 -1
- package/dist/test/datastructures/sortedCollection.spec.js +0 -106
- package/dist/test/datastructures/sortedCollection.spec.js.map +0 -1
- package/dist/test/deterministicRandomGenerator.spec.js +0 -18
- package/dist/test/deterministicRandomGenerator.spec.js.map +0 -1
- package/dist/test/error_objects/flaggedError.spec.js +0 -23
- package/dist/test/error_objects/flaggedError.spec.js.map +0 -1
- package/dist/test/error_objects/httpError.spec.js +0 -61
- package/dist/test/error_objects/httpError.spec.js.map +0 -1
- package/dist/test/error_objects/httpErrorNoStack.spec.js +0 -55
- package/dist/test/error_objects/httpErrorNoStack.spec.js.map +0 -1
- package/dist/test/error_objects/operationError.spec.js +0 -132
- package/dist/test/error_objects/operationError.spec.js.map +0 -1
- package/dist/test/guidUtils.spec.js +0 -184
- package/dist/test/guidUtils.spec.js.map +0 -1
- package/dist/test/strings/joinPaths.spec.js +0 -18
- package/dist/test/strings/joinPaths.spec.js.map +0 -1
- package/dist/test/tsconfig.tsbuildinfo +0 -2278
- package/nyc/mocha-junit-report.xml +0 -175
- package/src/test/chronometer.spec.ts +0 -99
- package/src/test/datastructures/collection.spec.ts +0 -567
- package/src/test/datastructures/dataArray.spec.ts +0 -81
- package/src/test/datastructures/sortedCollection.spec.ts +0 -128
- package/src/test/deterministicRandomGenerator.spec.ts +0 -18
- package/src/test/error_objects/flaggedError.spec.ts +0 -22
- package/src/test/error_objects/httpError.spec.ts +0 -68
- package/src/test/error_objects/httpErrorNoStack.spec.ts +0 -64
- package/src/test/error_objects/operationError.spec.ts +0 -152
- package/src/test/guidUtils.spec.ts +0 -213
- package/src/test/strings/joinPaths.spec.ts +0 -17
- package/src/test/tsconfig.json +0 -21
- package/tsconfig.esnext.tsbuildinfo +0 -824
- package/tsconfig.tsbuildinfo +0 -823
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
/**
|
|
11
|
-
* @fileoverview In this file, we will test property-common.Chronometer
|
|
12
|
-
*/
|
|
13
|
-
const sinon_1 = __importDefault(require("sinon"));
|
|
14
|
-
const chai_1 = require("chai");
|
|
15
|
-
const chronometer_1 = require("../chronometer");
|
|
16
|
-
describe("property-common.Chronometer", function () {
|
|
17
|
-
it("should exist", function () {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
19
|
-
chai_1.expect(chronometer_1.Chronometer).to.exist;
|
|
20
|
-
});
|
|
21
|
-
describe("elapsed", function () {
|
|
22
|
-
it("measures milliseconds", function (done) {
|
|
23
|
-
const expectedResultMilliSec = 50;
|
|
24
|
-
const chrono = new chronometer_1.Chronometer();
|
|
25
|
-
setTimeout(function () {
|
|
26
|
-
chrono.stop();
|
|
27
|
-
chai_1.expect(chrono.elapsedSec()).to.be.at.most((expectedResultMilliSec + 500) / 1000);
|
|
28
|
-
chai_1.expect(chrono.elapsedMilliSec()).to.be.at.least(expectedResultMilliSec - 25);
|
|
29
|
-
chai_1.expect(chrono.elapsedMilliSec()).to.be.at.most(expectedResultMilliSec + 500);
|
|
30
|
-
done();
|
|
31
|
-
}, expectedResultMilliSec);
|
|
32
|
-
});
|
|
33
|
-
it("measures microseconds", function (done) {
|
|
34
|
-
const expectedResultMilliSec = 10;
|
|
35
|
-
const chrono = new chronometer_1.Chronometer();
|
|
36
|
-
setTimeout(function () {
|
|
37
|
-
chrono.stop();
|
|
38
|
-
chai_1.expect(chrono.elapsedSec()).to.be.at.most((expectedResultMilliSec + 500) / 1000);
|
|
39
|
-
chai_1.expect(chrono.elapsedMicroSec()).to.be.at.least((expectedResultMilliSec - 25) * 1000);
|
|
40
|
-
chai_1.expect(chrono.elapsedMicroSec()).to.be.at.most((expectedResultMilliSec + 500) * 1000);
|
|
41
|
-
done();
|
|
42
|
-
}, expectedResultMilliSec);
|
|
43
|
-
});
|
|
44
|
-
it("@flaky measures seconds", function (done) {
|
|
45
|
-
const expectedResultMilliSec = 100;
|
|
46
|
-
const chrono = new chronometer_1.Chronometer();
|
|
47
|
-
setTimeout(function () {
|
|
48
|
-
chrono.stop();
|
|
49
|
-
chai_1.expect(chrono.elapsedSec()).to.be.at.most(expectedResultMilliSec / 1000 + 50);
|
|
50
|
-
chai_1.expect(chrono.elapsedMilliSec()).to.be.at.most(expectedResultMilliSec + 50);
|
|
51
|
-
done();
|
|
52
|
-
}, 10);
|
|
53
|
-
});
|
|
54
|
-
it("times promises", async function () {
|
|
55
|
-
const clock = sinon_1.default.useFakeTimers();
|
|
56
|
-
const expectedElapsedMilliSec = 50;
|
|
57
|
-
const expectedResult = 199999;
|
|
58
|
-
let resolve;
|
|
59
|
-
const promise = new Promise((_resolve) => { resolve = _resolve; });
|
|
60
|
-
setTimeout(function () {
|
|
61
|
-
resolve(expectedResult);
|
|
62
|
-
}, expectedElapsedMilliSec);
|
|
63
|
-
const expectations = chronometer_1.Chronometer.timePromise(async () => promise)
|
|
64
|
-
.then(function (timedResult) {
|
|
65
|
-
chai_1.expect(timedResult.chrono.elapsedMilliSec()).to.be.at.least(expectedElapsedMilliSec - 5);
|
|
66
|
-
chai_1.expect(timedResult.chrono.elapsedMilliSec()).to.be.at.most(expectedElapsedMilliSec + 50);
|
|
67
|
-
chai_1.expect(timedResult.chrono.elapsedMicroSec()).to.be.at.least((expectedElapsedMilliSec - 5) * 1000);
|
|
68
|
-
chai_1.expect(timedResult.chrono.elapsedMicroSec()).to.be.at.most((expectedElapsedMilliSec + 50) * 1000);
|
|
69
|
-
chai_1.expect(timedResult.result).to.equal(expectedResult);
|
|
70
|
-
})
|
|
71
|
-
.then(function () {
|
|
72
|
-
clock.restore();
|
|
73
|
-
});
|
|
74
|
-
clock.tick(expectedElapsedMilliSec + 1);
|
|
75
|
-
return expectations;
|
|
76
|
-
});
|
|
77
|
-
it("@bugfix Cannot read property '0' of undefined", function (done) {
|
|
78
|
-
let chrono = new chronometer_1.Chronometer();
|
|
79
|
-
// Prior to the bug fix, not stopping the chrono before measuring elapsed time
|
|
80
|
-
// causes "Cannot read property '0' of undefined":
|
|
81
|
-
chai_1.expect(chrono.elapsedSec()).to.not.equal(undefined); // <-- chrono is not stopped
|
|
82
|
-
chrono = new chronometer_1.Chronometer();
|
|
83
|
-
chai_1.expect(chrono.elapsedMilliSec()).to.not.equal(undefined); // <-- chrono is not stopped
|
|
84
|
-
chrono = new chronometer_1.Chronometer();
|
|
85
|
-
chai_1.expect(chrono.elapsedMicroSec()).to.not.equal(undefined); // <-- chrono is not stopped
|
|
86
|
-
done();
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
//# sourceMappingURL=chronometer.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chronometer.spec.js","sourceRoot":"","sources":["../../src/test/chronometer.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH;;GAEG;AAEH,kDAA0B;AAC1B,+BAA8B;AAC9B,gDAA6C;AAE7C,QAAQ,CAAC,6BAA6B,EAAE;IACpC,EAAE,CAAC,cAAc,EAAE;QACf,oEAAoE;QACpE,aAAM,CAA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YAC9E,kDAAkD;YAClD,aAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAE,4BAA4B;YAElF,MAAM,GAAG,IAAI,yBAAW,EAAE,CAAC;YAC3B,aAAM,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAE,4BAA4B;YAEvF,MAAM,GAAG,IAAI,yBAAW,EAAE,CAAC;YAC3B,aAAM,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAE,4BAA4B;YAEvF,IAAI,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview In this file, we will test property-common.Chronometer\n */\n\nimport sinon from \"sinon\";\nimport { expect } from \"chai\";\nimport { Chronometer } from \"../chronometer\";\n\ndescribe(\"property-common.Chronometer\", function() {\n it(\"should exist\", function() {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n expect(Chronometer).to.exist;\n });\n\n describe(\"elapsed\", function() {\n it(\"measures milliseconds\", function(done) {\n const expectedResultMilliSec = 50;\n const chrono = new Chronometer();\n setTimeout(function() {\n chrono.stop();\n expect(chrono.elapsedSec()).to.be.at.most((expectedResultMilliSec + 500) / 1000);\n expect(chrono.elapsedMilliSec()).to.be.at.least(expectedResultMilliSec - 25);\n expect(chrono.elapsedMilliSec()).to.be.at.most(expectedResultMilliSec + 500);\n done();\n }, expectedResultMilliSec);\n });\n\n it(\"measures microseconds\", function(done) {\n const expectedResultMilliSec = 10;\n const chrono = new Chronometer();\n setTimeout(function() {\n chrono.stop();\n expect(chrono.elapsedSec()).to.be.at.most((expectedResultMilliSec + 500) / 1000);\n expect(chrono.elapsedMicroSec()).to.be.at.least((expectedResultMilliSec - 25) * 1000);\n expect(chrono.elapsedMicroSec()).to.be.at.most((expectedResultMilliSec + 500) * 1000);\n done();\n }, expectedResultMilliSec);\n });\n\n it(\"@flaky measures seconds\", function(done) {\n const expectedResultMilliSec = 100;\n const chrono = new Chronometer();\n setTimeout(function() {\n chrono.stop();\n expect(chrono.elapsedSec()).to.be.at.most(expectedResultMilliSec / 1000 + 50);\n expect(chrono.elapsedMilliSec()).to.be.at.most(expectedResultMilliSec + 50);\n done();\n }, 10);\n });\n\n it(\"times promises\", async function() {\n const clock = sinon.useFakeTimers();\n const expectedElapsedMilliSec = 50;\n const expectedResult = 199999;\n let resolve;\n const promise = new Promise((_resolve) => { resolve = _resolve; });\n\n setTimeout(function() {\n resolve(expectedResult);\n }, expectedElapsedMilliSec);\n\n const expectations: Promise<void> = Chronometer.timePromise(async () => promise)\n .then(function(timedResult) {\n expect(timedResult.chrono.elapsedMilliSec()).to.be.at.least(expectedElapsedMilliSec - 5);\n expect(timedResult.chrono.elapsedMilliSec()).to.be.at.most(expectedElapsedMilliSec + 50);\n expect(timedResult.chrono.elapsedMicroSec()).to.be.at.least((expectedElapsedMilliSec - 5) * 1000);\n expect(timedResult.chrono.elapsedMicroSec()).to.be.at.most((expectedElapsedMilliSec + 50) * 1000);\n expect(timedResult.result).to.equal(expectedResult);\n })\n .then(function() {\n clock.restore();\n });\n\n clock.tick(expectedElapsedMilliSec + 1);\n\n return expectations;\n });\n\n it(\"@bugfix Cannot read property '0' of undefined\", function(done) {\n let chrono = new Chronometer();\n // Prior to the bug fix, not stopping the chrono before measuring elapsed time\n // causes \"Cannot read property '0' of undefined\":\n expect(chrono.elapsedSec()).to.not.equal(undefined); // <-- chrono is not stopped\n\n chrono = new Chronometer();\n expect(chrono.elapsedMilliSec()).to.not.equal(undefined); // <-- chrono is not stopped\n\n chrono = new Chronometer();\n expect(chrono.elapsedMicroSec()).to.not.equal(undefined); // <-- chrono is not stopped\n\n done();\n });\n });\n});\n"]}
|
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
/**
|
|
11
|
-
* @fileoverview In this file, we will test the functions exported by datastructres/collection.js
|
|
12
|
-
*/
|
|
13
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
14
|
-
const chai_1 = require("chai");
|
|
15
|
-
const index_1 = require("../../index");
|
|
16
|
-
describe("collection", function () {
|
|
17
|
-
const createObject = () => ({
|
|
18
|
-
item4: Number.NaN,
|
|
19
|
-
item5: undefined,
|
|
20
|
-
// eslint-disable-next-line no-null/no-null
|
|
21
|
-
item6: null,
|
|
22
|
-
item7: "",
|
|
23
|
-
item8: false,
|
|
24
|
-
item9: {},
|
|
25
|
-
item10: [],
|
|
26
|
-
item11: "test",
|
|
27
|
-
item12: 0,
|
|
28
|
-
item13: 1,
|
|
29
|
-
});
|
|
30
|
-
it("should add a value under a key", function (done) {
|
|
31
|
-
const collection = new index_1.Collection();
|
|
32
|
-
chai_1.expect(collection.add("item1", "test")).to.equal("test");
|
|
33
|
-
chai_1.expect(collection.has("item1")).to.equal(true);
|
|
34
|
-
collection.add(0, "test2");
|
|
35
|
-
chai_1.expect(collection.has(0)).to.equal(true);
|
|
36
|
-
done();
|
|
37
|
-
});
|
|
38
|
-
it("should bulk add a key-value object to the list of items", function (done) {
|
|
39
|
-
const collection = new index_1.Collection();
|
|
40
|
-
const objectToAdd = createObject();
|
|
41
|
-
chai_1.expect(collection.bulkAdd(objectToAdd)).to.equal(collection);
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
43
|
-
const itemExists = lodash_1.default.every(objectToAdd, (item, key) => collection.has(key));
|
|
44
|
-
chai_1.expect(itemExists).to.equal(true);
|
|
45
|
-
done();
|
|
46
|
-
});
|
|
47
|
-
it("should remove a value associated with a key", function (done) {
|
|
48
|
-
const collection = new index_1.Collection();
|
|
49
|
-
collection.add("item1", "test");
|
|
50
|
-
chai_1.expect(collection.remove("item1")).to.equal(true);
|
|
51
|
-
chai_1.expect(collection.has("item1")).to.equal(false);
|
|
52
|
-
chai_1.expect(collection.remove("item1")).to.equal(false);
|
|
53
|
-
done();
|
|
54
|
-
});
|
|
55
|
-
it("should bulk remove a key-value object from the list of items", function (done) {
|
|
56
|
-
const collection = new index_1.Collection();
|
|
57
|
-
const objectToAdd = createObject();
|
|
58
|
-
collection.bulkAdd(objectToAdd);
|
|
59
|
-
collection.bulkRemove(objectToAdd);
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
61
|
-
const itemExists = lodash_1.default.every(objectToAdd, (item, key) => collection.has(key));
|
|
62
|
-
chai_1.expect(itemExists).to.equal(false);
|
|
63
|
-
done();
|
|
64
|
-
});
|
|
65
|
-
it("should check for emptyness", function (done) {
|
|
66
|
-
const collection = new index_1.Collection();
|
|
67
|
-
chai_1.expect(collection.isEmpty()).to.equal(true);
|
|
68
|
-
collection.add("item1", "test");
|
|
69
|
-
chai_1.expect(collection.isEmpty()).to.equal(false);
|
|
70
|
-
done();
|
|
71
|
-
});
|
|
72
|
-
it("should get the first value in the collection", function (done) {
|
|
73
|
-
const collection = new index_1.Collection();
|
|
74
|
-
collection.add("item1", "test1");
|
|
75
|
-
collection.add("item2", "test2");
|
|
76
|
-
chai_1.expect(collection.getFirstItem()).to.equal("test1");
|
|
77
|
-
done();
|
|
78
|
-
});
|
|
79
|
-
it("should get the last value in the collection", function (done) {
|
|
80
|
-
const collection = new index_1.Collection();
|
|
81
|
-
collection.add("item1", "test1");
|
|
82
|
-
collection.add("item2", "test2");
|
|
83
|
-
chai_1.expect(collection.getLastItem()).to.equal("test2");
|
|
84
|
-
done();
|
|
85
|
-
});
|
|
86
|
-
it("should get the type of the collection", function (done) {
|
|
87
|
-
const collection = new index_1.Collection("collection1", Array);
|
|
88
|
-
chai_1.expect(collection.getType()).to.equal(Array);
|
|
89
|
-
done();
|
|
90
|
-
});
|
|
91
|
-
it("should filter out values based on a predicate function", function (done) {
|
|
92
|
-
const collection = new index_1.Collection();
|
|
93
|
-
const objectToAdd = {
|
|
94
|
-
item1: 0,
|
|
95
|
-
item2: 2,
|
|
96
|
-
item3: 3,
|
|
97
|
-
};
|
|
98
|
-
collection.bulkAdd(objectToAdd);
|
|
99
|
-
const filteredCollection = collection.filter((key, item) => item > 0);
|
|
100
|
-
chai_1.expect(filteredCollection.has("item1")).to.equal(false);
|
|
101
|
-
chai_1.expect(filteredCollection.has("item2")).to.equal(true);
|
|
102
|
-
chai_1.expect(filteredCollection.has("item3")).to.equal(true);
|
|
103
|
-
done();
|
|
104
|
-
});
|
|
105
|
-
it("should filter out values based on a key predicate", function (done) {
|
|
106
|
-
const collection = new index_1.Collection();
|
|
107
|
-
const objectToAdd = {
|
|
108
|
-
item1: 0,
|
|
109
|
-
item2: 2,
|
|
110
|
-
item3: 3,
|
|
111
|
-
};
|
|
112
|
-
collection.bulkAdd(objectToAdd);
|
|
113
|
-
const filteredCollection = collection.filterByKey(["item2", "item3"]);
|
|
114
|
-
chai_1.expect(filteredCollection.has("item1")).to.equal(false);
|
|
115
|
-
chai_1.expect(filteredCollection.has("item2")).to.equal(true);
|
|
116
|
-
chai_1.expect(filteredCollection.has("item3")).to.equal(true);
|
|
117
|
-
const filteredCollection2 = collection.filterByKey("item2");
|
|
118
|
-
chai_1.expect(filteredCollection2.has("item1")).to.equal(false);
|
|
119
|
-
chai_1.expect(filteredCollection2.has("item2")).to.equal(true);
|
|
120
|
-
chai_1.expect(filteredCollection2.has("item3")).to.equal(false);
|
|
121
|
-
done();
|
|
122
|
-
});
|
|
123
|
-
it("should filter out values based on a value predicate", function (done) {
|
|
124
|
-
const collection = new index_1.Collection();
|
|
125
|
-
const objectToAdd = {
|
|
126
|
-
item1: 0,
|
|
127
|
-
item2: 2,
|
|
128
|
-
item3: 3,
|
|
129
|
-
};
|
|
130
|
-
collection.bulkAdd(objectToAdd);
|
|
131
|
-
const filteredCollection = collection.filterByValue(objectToAdd.item1);
|
|
132
|
-
chai_1.expect(filteredCollection.has("item1")).to.equal(true);
|
|
133
|
-
chai_1.expect(filteredCollection.has("item2")).to.equal(false);
|
|
134
|
-
chai_1.expect(filteredCollection.has("item3")).to.equal(false);
|
|
135
|
-
done();
|
|
136
|
-
});
|
|
137
|
-
it("should return the number of elements in the collection", function (done) {
|
|
138
|
-
const collection = new index_1.Collection();
|
|
139
|
-
const objectToAdd = {
|
|
140
|
-
item1: 0,
|
|
141
|
-
item2: 2,
|
|
142
|
-
item3: 3,
|
|
143
|
-
};
|
|
144
|
-
collection.bulkAdd(objectToAdd);
|
|
145
|
-
chai_1.expect(collection.getCount()).to.equal(3);
|
|
146
|
-
done();
|
|
147
|
-
});
|
|
148
|
-
it("should return the list of items in an array", function (done) {
|
|
149
|
-
const collection = new index_1.Collection();
|
|
150
|
-
const objectToAdd = {
|
|
151
|
-
item1: 0,
|
|
152
|
-
item2: 2,
|
|
153
|
-
item3: 3,
|
|
154
|
-
};
|
|
155
|
-
collection.bulkAdd(objectToAdd);
|
|
156
|
-
const array = collection.getAsArray();
|
|
157
|
-
chai_1.expect(array).to.be.an("array");
|
|
158
|
-
const exists = lodash_1.default.every(objectToAdd, (item) => lodash_1.default.includes(array, item));
|
|
159
|
-
chai_1.expect(exists).to.equal(true);
|
|
160
|
-
done();
|
|
161
|
-
});
|
|
162
|
-
it("should check if an item exists", function (done) {
|
|
163
|
-
const collection = new index_1.Collection();
|
|
164
|
-
const objectToAdd = {
|
|
165
|
-
item1: 0,
|
|
166
|
-
item2: 2,
|
|
167
|
-
item3: 3,
|
|
168
|
-
};
|
|
169
|
-
collection.bulkAdd(objectToAdd);
|
|
170
|
-
chai_1.expect(collection.has("item2")).to.equal(true);
|
|
171
|
-
chai_1.expect(collection.has("foo")).to.equal(false);
|
|
172
|
-
done();
|
|
173
|
-
});
|
|
174
|
-
it("should get an item from the collection", function (done) {
|
|
175
|
-
const collection = new index_1.Collection();
|
|
176
|
-
const objectToAdd = {
|
|
177
|
-
item1: 0,
|
|
178
|
-
item2: 2,
|
|
179
|
-
item3: 3,
|
|
180
|
-
};
|
|
181
|
-
collection.bulkAdd(objectToAdd);
|
|
182
|
-
chai_1.expect(collection.item("item2")).to.equal(objectToAdd.item2);
|
|
183
|
-
done();
|
|
184
|
-
});
|
|
185
|
-
it("should set the value of a key", function (done) {
|
|
186
|
-
const collection = new index_1.Collection();
|
|
187
|
-
const objectToAdd = {
|
|
188
|
-
item1: 0,
|
|
189
|
-
item2: 2,
|
|
190
|
-
item3: 3,
|
|
191
|
-
};
|
|
192
|
-
collection.bulkAdd(objectToAdd);
|
|
193
|
-
collection.set("item1", 5);
|
|
194
|
-
chai_1.expect(collection.item("item1")).to.equal(5);
|
|
195
|
-
done();
|
|
196
|
-
});
|
|
197
|
-
it("should iterate over the set of items", function (done) {
|
|
198
|
-
const collection = new index_1.Collection();
|
|
199
|
-
const objectToAdd = {
|
|
200
|
-
item1: 0,
|
|
201
|
-
item2: 2,
|
|
202
|
-
item3: 3,
|
|
203
|
-
};
|
|
204
|
-
collection.bulkAdd(objectToAdd);
|
|
205
|
-
const result = {};
|
|
206
|
-
collection.iterate(function (key, item) {
|
|
207
|
-
result[key] = item;
|
|
208
|
-
});
|
|
209
|
-
chai_1.expect(result).to.deep.equal(objectToAdd);
|
|
210
|
-
done();
|
|
211
|
-
});
|
|
212
|
-
it("should iterate over the set of items starting from the tail", function (done) {
|
|
213
|
-
const collection = new index_1.Collection();
|
|
214
|
-
const objectToAdd = {
|
|
215
|
-
item1: 0,
|
|
216
|
-
item2: 2,
|
|
217
|
-
item3: 3,
|
|
218
|
-
};
|
|
219
|
-
collection.bulkAdd(objectToAdd);
|
|
220
|
-
const result = {};
|
|
221
|
-
const keys = collection.getKeys();
|
|
222
|
-
let i = keys.length - 1;
|
|
223
|
-
collection.iterateFromTail(function (key, item) {
|
|
224
|
-
result[key] = item;
|
|
225
|
-
chai_1.expect(key).to.equal(keys[i]);
|
|
226
|
-
i--;
|
|
227
|
-
});
|
|
228
|
-
chai_1.expect(result).to.deep.equal(objectToAdd);
|
|
229
|
-
done();
|
|
230
|
-
});
|
|
231
|
-
it("should return all items in an JSON format", function (done) {
|
|
232
|
-
const collection = new index_1.Collection();
|
|
233
|
-
const objectToAdd = {
|
|
234
|
-
item1: 0,
|
|
235
|
-
item2: 2,
|
|
236
|
-
item3: 3,
|
|
237
|
-
};
|
|
238
|
-
collection.bulkAdd(objectToAdd);
|
|
239
|
-
chai_1.expect(collection.getItems()).to.deep.equal(objectToAdd);
|
|
240
|
-
done();
|
|
241
|
-
});
|
|
242
|
-
it("should return all keys in an array", function (done) {
|
|
243
|
-
const collection = new index_1.Collection();
|
|
244
|
-
const objectToAdd = {
|
|
245
|
-
item1: 0,
|
|
246
|
-
item2: 2,
|
|
247
|
-
item3: 3,
|
|
248
|
-
};
|
|
249
|
-
collection.bulkAdd(objectToAdd);
|
|
250
|
-
chai_1.expect(collection.getKeys()).to.deep.equal(lodash_1.default.keys(objectToAdd));
|
|
251
|
-
done();
|
|
252
|
-
});
|
|
253
|
-
it("should return the first item in the collection along with the key", function (done) {
|
|
254
|
-
const collection = new index_1.Collection();
|
|
255
|
-
collection.add("item1", "test1");
|
|
256
|
-
collection.add("item2", "test2");
|
|
257
|
-
chai_1.expect(collection.peak()).to.deep.equal({ key: "item1", item: "test1" });
|
|
258
|
-
done();
|
|
259
|
-
});
|
|
260
|
-
describe("clear", function () {
|
|
261
|
-
it("should empty the collection", function (done) {
|
|
262
|
-
const collection = new index_1.Collection();
|
|
263
|
-
const objectToAdd = {
|
|
264
|
-
item1: 0,
|
|
265
|
-
item2: 2,
|
|
266
|
-
item3: 3,
|
|
267
|
-
};
|
|
268
|
-
collection.bulkAdd(objectToAdd);
|
|
269
|
-
const ret = collection.clear();
|
|
270
|
-
chai_1.expect(collection.isEmpty()).to.equal(true);
|
|
271
|
-
chai_1.expect(ret).to.equal(collection);
|
|
272
|
-
done();
|
|
273
|
-
});
|
|
274
|
-
it("should return the collection itself", function (done) {
|
|
275
|
-
const collection = new index_1.Collection();
|
|
276
|
-
const ret = collection.clear();
|
|
277
|
-
chai_1.expect(ret).to.equal(collection);
|
|
278
|
-
done();
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
it("should clone the collection", function (done) {
|
|
282
|
-
const collection = new index_1.Collection();
|
|
283
|
-
const objectToAdd = {
|
|
284
|
-
item1: 0,
|
|
285
|
-
item2: 2,
|
|
286
|
-
item3: 3,
|
|
287
|
-
};
|
|
288
|
-
collection.bulkAdd(objectToAdd);
|
|
289
|
-
chai_1.expect(collection.clone().items).to.deep.equal(collection.items);
|
|
290
|
-
done();
|
|
291
|
-
});
|
|
292
|
-
it("should copy the collection", function (done) {
|
|
293
|
-
const collection = new index_1.Collection();
|
|
294
|
-
const objectToAdd = {
|
|
295
|
-
item1: "test",
|
|
296
|
-
item2: true,
|
|
297
|
-
item3: 23,
|
|
298
|
-
};
|
|
299
|
-
collection.bulkAdd(objectToAdd);
|
|
300
|
-
const collection2 = new index_1.Collection();
|
|
301
|
-
collection2.copy(collection);
|
|
302
|
-
chai_1.expect(collection2.items.item1).to.equal(objectToAdd.item1);
|
|
303
|
-
chai_1.expect(collection2.items.item2).to.equal(objectToAdd.item2);
|
|
304
|
-
chai_1.expect(collection2.items.item3).to.equal(objectToAdd.item3);
|
|
305
|
-
done();
|
|
306
|
-
});
|
|
307
|
-
it("should invoke the onAdd callback", function (done) {
|
|
308
|
-
const collection = new index_1.Collection();
|
|
309
|
-
let triggered = false;
|
|
310
|
-
collection.onAdd = function (key, item) {
|
|
311
|
-
triggered = true;
|
|
312
|
-
chai_1.expect(key).to.equal("item");
|
|
313
|
-
chai_1.expect(item).to.equal("value");
|
|
314
|
-
};
|
|
315
|
-
collection.add("item", "value");
|
|
316
|
-
chai_1.expect(triggered).to.equal(true);
|
|
317
|
-
let callbackCounter = 0;
|
|
318
|
-
const objectToAdd = createObject();
|
|
319
|
-
// now override the onAdd function and check wiether we call it
|
|
320
|
-
// when we bulkAdd
|
|
321
|
-
collection.onAdd = function (key, item) {
|
|
322
|
-
callbackCounter++;
|
|
323
|
-
chai_1.expect(Object.prototype.hasOwnProperty.call(objectToAdd, key)).to.equal(true);
|
|
324
|
-
};
|
|
325
|
-
collection.bulkAdd(objectToAdd);
|
|
326
|
-
chai_1.expect(callbackCounter).to.equal(lodash_1.default.keys(objectToAdd).length);
|
|
327
|
-
done();
|
|
328
|
-
});
|
|
329
|
-
it("should invoke the onRemove callback", function (done) {
|
|
330
|
-
const collection = new index_1.Collection();
|
|
331
|
-
let triggered = false;
|
|
332
|
-
collection.onRemove = function (key, item) {
|
|
333
|
-
triggered = true;
|
|
334
|
-
chai_1.expect(key).to.equal("item");
|
|
335
|
-
chai_1.expect(item).to.equal("value");
|
|
336
|
-
};
|
|
337
|
-
collection.add("item", "value");
|
|
338
|
-
collection.remove("item");
|
|
339
|
-
chai_1.expect(triggered).to.equal(true);
|
|
340
|
-
// Should not invoke the onRemove here
|
|
341
|
-
triggered = false;
|
|
342
|
-
collection.remove("item");
|
|
343
|
-
chai_1.expect(triggered).to.equal(false);
|
|
344
|
-
let callbackCounter = 0;
|
|
345
|
-
const objectToAdd = createObject();
|
|
346
|
-
// now override the onRemove function and check wiether we call it
|
|
347
|
-
// when we bulkRemove
|
|
348
|
-
collection.onRemove = function (key, item) {
|
|
349
|
-
callbackCounter++;
|
|
350
|
-
chai_1.expect(Object.prototype.hasOwnProperty.call(objectToAdd, key)).to.equal(true);
|
|
351
|
-
};
|
|
352
|
-
collection.bulkAdd(objectToAdd);
|
|
353
|
-
collection.bulkRemove(objectToAdd);
|
|
354
|
-
chai_1.expect(callbackCounter).to.equal(lodash_1.default.keys(objectToAdd).length);
|
|
355
|
-
done();
|
|
356
|
-
});
|
|
357
|
-
it("should stop early when iterating", function () {
|
|
358
|
-
const collection = new index_1.Collection();
|
|
359
|
-
const objectToAdd = {
|
|
360
|
-
item1: "test",
|
|
361
|
-
item2: true,
|
|
362
|
-
item3: 23,
|
|
363
|
-
};
|
|
364
|
-
collection.bulkAdd(objectToAdd);
|
|
365
|
-
let iterator = 1;
|
|
366
|
-
collection.iterate(function () {
|
|
367
|
-
if (iterator === 2) {
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
iterator++;
|
|
371
|
-
return true;
|
|
372
|
-
});
|
|
373
|
-
chai_1.expect(iterator).to.equal(2);
|
|
374
|
-
iterator = 1;
|
|
375
|
-
collection.iterateFromTail(function () {
|
|
376
|
-
if (iterator === 2) {
|
|
377
|
-
return false;
|
|
378
|
-
}
|
|
379
|
-
iterator++;
|
|
380
|
-
return true;
|
|
381
|
-
});
|
|
382
|
-
chai_1.expect(iterator).to.equal(2);
|
|
383
|
-
});
|
|
384
|
-
it("should invoke the onClear callback", function (done) {
|
|
385
|
-
const collection = new index_1.Collection();
|
|
386
|
-
const objectToAdd = createObject();
|
|
387
|
-
let triggered = false;
|
|
388
|
-
collection.onClear = function (items) {
|
|
389
|
-
triggered = true;
|
|
390
|
-
chai_1.expect(items).to.deep.equal(objectToAdd);
|
|
391
|
-
};
|
|
392
|
-
// this shouldn't invoke the callback
|
|
393
|
-
collection.clear();
|
|
394
|
-
chai_1.expect(triggered).to.equal(false);
|
|
395
|
-
collection.bulkAdd(objectToAdd);
|
|
396
|
-
collection.clear();
|
|
397
|
-
chai_1.expect(triggered).to.equal(true);
|
|
398
|
-
done();
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
//# sourceMappingURL=collection.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|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O,GAAG,UAAS,KAAK;YAC/B,SAAS,GAAG,IAAI,CAAC;YACjB,aAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC,CAAC;QAEF,qCAAqC;QACrC,UAAU,CAAC,KAAK,EAAE,CAAC;QAEnB,aAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAElC,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChC,UAAU,CAAC,KAAK,EAAE,CAAC;QAEnB,aAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEjC,IAAI,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview In this file, we will test the functions exported by datastructres/collection.js\n */\n\nimport _ from \"lodash\";\nimport { expect } from \"chai\";\nimport { Collection } from \"../../index\";\n\ndescribe(\"collection\", function() {\n const createObject = () => ({\n item4: Number.NaN,\n item5: undefined,\n // eslint-disable-next-line no-null/no-null\n item6: null,\n item7: \"\",\n item8: false,\n item9: {},\n item10: [],\n item11: \"test\",\n item12: 0,\n item13: 1,\n });\n\n it(\"should add a value under a key\", function(done) {\n const collection = new Collection<string>();\n\n expect(collection.add(\"item1\", \"test\")).to.equal(\"test\");\n\n expect(collection.has(\"item1\")).to.equal(true);\n\n collection.add(0, \"test2\");\n\n expect(collection.has(0)).to.equal(true);\n\n done();\n });\n\n it(\"should bulk add a key-value object to the list of items\", function(done) {\n const collection = new Collection<any>();\n\n const objectToAdd = createObject();\n\n expect(collection.bulkAdd(objectToAdd)).to.equal(collection);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n const itemExists = _.every(objectToAdd, (item, key) => collection.has(key));\n\n expect(itemExists).to.equal(true);\n\n done();\n });\n\n it(\"should remove a value associated with a key\", function(done) {\n const collection = new Collection<string>();\n\n collection.add(\"item1\", \"test\");\n\n expect(collection.remove(\"item1\")).to.equal(true);\n\n expect(collection.has(\"item1\")).to.equal(false);\n\n expect(collection.remove(\"item1\")).to.equal(false);\n\n done();\n });\n\n it(\"should bulk remove a key-value object from the list of items\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = createObject();\n\n collection.bulkAdd(objectToAdd);\n collection.bulkRemove(objectToAdd);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n const itemExists = _.every(objectToAdd, (item, key) => collection.has(key));\n\n expect(itemExists).to.equal(false);\n\n done();\n });\n\n it(\"should check for emptyness\", function(done) {\n const collection = new Collection<string>();\n\n expect(collection.isEmpty()).to.equal(true);\n\n collection.add(\"item1\", \"test\");\n\n expect(collection.isEmpty()).to.equal(false);\n done();\n });\n\n it(\"should get the first value in the collection\", function(done) {\n const collection = new Collection<string>();\n\n collection.add(\"item1\", \"test1\");\n collection.add(\"item2\", \"test2\");\n\n expect(collection.getFirstItem()).to.equal(\"test1\");\n done();\n });\n\n it(\"should get the last value in the collection\", function(done) {\n const collection = new Collection<string>();\n\n collection.add(\"item1\", \"test1\");\n collection.add(\"item2\", \"test2\");\n\n expect(collection.getLastItem()).to.equal(\"test2\");\n done();\n });\n\n it(\"should get the type of the collection\", function(done) {\n const collection = new Collection(\"collection1\", Array);\n\n expect(collection.getType()).to.equal(Array);\n\n done();\n });\n\n it(\"should filter out values based on a predicate function\", function(done) {\n const collection = new Collection<number>();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const filteredCollection = collection.filter((key, item) => item > 0);\n\n expect(filteredCollection.has(\"item1\")).to.equal(false);\n expect(filteredCollection.has(\"item2\")).to.equal(true);\n expect(filteredCollection.has(\"item3\")).to.equal(true);\n\n done();\n });\n\n it(\"should filter out values based on a key predicate\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const filteredCollection = collection.filterByKey([\"item2\", \"item3\"]);\n\n expect(filteredCollection.has(\"item1\")).to.equal(false);\n expect(filteredCollection.has(\"item2\")).to.equal(true);\n expect(filteredCollection.has(\"item3\")).to.equal(true);\n\n const filteredCollection2 = collection.filterByKey(\"item2\");\n\n expect(filteredCollection2.has(\"item1\")).to.equal(false);\n expect(filteredCollection2.has(\"item2\")).to.equal(true);\n expect(filteredCollection2.has(\"item3\")).to.equal(false);\n\n done();\n });\n\n it(\"should filter out values based on a value predicate\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const filteredCollection = collection.filterByValue(objectToAdd.item1);\n\n expect(filteredCollection.has(\"item1\")).to.equal(true);\n expect(filteredCollection.has(\"item2\")).to.equal(false);\n expect(filteredCollection.has(\"item3\")).to.equal(false);\n\n done();\n });\n\n it(\"should return the number of elements in the collection\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n expect(collection.getCount()).to.equal(3);\n done();\n });\n\n it(\"should return the list of items in an array\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const array = collection.getAsArray();\n\n expect(array).to.be.an(\"array\");\n\n const exists = _.every(objectToAdd, (item) => _.includes(array, item));\n\n expect(exists).to.equal(true);\n\n done();\n });\n\n it(\"should check if an item exists\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n expect(collection.has(\"item2\")).to.equal(true);\n expect(collection.has(\"foo\")).to.equal(false);\n\n done();\n });\n\n it(\"should get an item from the collection\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n expect(collection.item(\"item2\")).to.equal(objectToAdd.item2);\n\n done();\n });\n\n it(\"should set the value of a key\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n collection.set(\"item1\", 5);\n\n expect(collection.item(\"item1\")).to.equal(5);\n\n done();\n });\n\n it(\"should iterate over the set of items\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const result = {};\n collection.iterate(function(key, item) {\n result[key] = item;\n });\n\n expect(result).to.deep.equal(objectToAdd);\n\n done();\n });\n\n it(\"should iterate over the set of items starting from the tail\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const result = {};\n const keys = collection.getKeys();\n let i = keys.length - 1;\n collection.iterateFromTail(function(key, item) {\n result[key] = item;\n expect(key).to.equal(keys[i]);\n i--;\n });\n\n expect(result).to.deep.equal(objectToAdd);\n\n done();\n });\n\n it(\"should return all items in an JSON format\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n expect(collection.getItems()).to.deep.equal(objectToAdd);\n\n done();\n });\n\n it(\"should return all keys in an array\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n expect(collection.getKeys()).to.deep.equal(_.keys(objectToAdd));\n\n done();\n });\n\n it(\"should return the first item in the collection along with the key\", function(done) {\n const collection = new Collection();\n\n collection.add(\"item1\", \"test1\");\n collection.add(\"item2\", \"test2\");\n\n expect(collection.peak()).to.deep.equal({ key: \"item1\", item: \"test1\" });\n\n done();\n });\n\n describe(\"clear\", function() {\n it(\"should empty the collection\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const ret = collection.clear();\n\n expect(collection.isEmpty()).to.equal(true);\n expect(ret).to.equal(collection);\n\n done();\n });\n\n it(\"should return the collection itself\", function(done) {\n const collection = new Collection();\n const ret = collection.clear();\n expect(ret).to.equal(collection);\n done();\n });\n });\n\n it(\"should clone the collection\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: 0,\n item2: 2,\n item3: 3,\n };\n\n collection.bulkAdd(objectToAdd);\n\n expect(collection.clone().items).to.deep.equal(collection.items);\n\n done();\n });\n\n it(\"should copy the collection\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: \"test\",\n item2: true,\n item3: 23,\n };\n\n collection.bulkAdd(objectToAdd);\n\n const collection2 = new Collection();\n\n collection2.copy(collection);\n\n expect(collection2.items.item1).to.equal(objectToAdd.item1);\n expect(collection2.items.item2).to.equal(objectToAdd.item2);\n expect(collection2.items.item3).to.equal(objectToAdd.item3);\n\n done();\n });\n\n it(\"should invoke the onAdd callback\", function(done) {\n const collection = new Collection();\n\n let triggered = false;\n\n collection.onAdd = function(key, item) {\n triggered = true;\n expect(key).to.equal(\"item\");\n expect(item).to.equal(\"value\");\n };\n collection.add(\"item\", \"value\");\n\n expect(triggered).to.equal(true);\n\n let callbackCounter = 0;\n const objectToAdd = createObject();\n\n // now override the onAdd function and check wiether we call it\n // when we bulkAdd\n collection.onAdd = function(key, item) {\n callbackCounter++;\n expect(Object.prototype.hasOwnProperty.call(objectToAdd, key)).to.equal(true);\n };\n\n collection.bulkAdd(objectToAdd);\n expect(callbackCounter).to.equal(_.keys(objectToAdd).length);\n\n done();\n });\n\n it(\"should invoke the onRemove callback\", function(done) {\n const collection = new Collection();\n\n let triggered = false;\n\n collection.onRemove = function(key, item) {\n triggered = true;\n expect(key).to.equal(\"item\");\n expect(item).to.equal(\"value\");\n };\n\n collection.add(\"item\", \"value\");\n collection.remove(\"item\");\n expect(triggered).to.equal(true);\n\n // Should not invoke the onRemove here\n triggered = false;\n collection.remove(\"item\");\n\n expect(triggered).to.equal(false);\n\n let callbackCounter = 0;\n const objectToAdd = createObject();\n\n // now override the onRemove function and check wiether we call it\n // when we bulkRemove\n collection.onRemove = function(key, item) {\n callbackCounter++;\n expect(Object.prototype.hasOwnProperty.call(objectToAdd, key)).to.equal(true);\n };\n\n collection.bulkAdd(objectToAdd);\n collection.bulkRemove(objectToAdd);\n\n expect(callbackCounter).to.equal(_.keys(objectToAdd).length);\n\n done();\n });\n\n it(\"should stop early when iterating\", function() {\n const collection = new Collection();\n\n const objectToAdd = {\n item1: \"test\",\n item2: true,\n item3: 23,\n };\n\n collection.bulkAdd(objectToAdd);\n\n let iterator = 1;\n\n collection.iterate(function() {\n if (iterator === 2) {\n return false;\n }\n\n iterator++;\n\n return true;\n });\n\n expect(iterator).to.equal(2);\n\n iterator = 1;\n\n collection.iterateFromTail(function() {\n if (iterator === 2) {\n return false;\n }\n\n iterator++;\n\n return true;\n });\n\n expect(iterator).to.equal(2);\n });\n\n it(\"should invoke the onClear callback\", function(done) {\n const collection = new Collection();\n\n const objectToAdd = createObject();\n let triggered = false;\n collection.onClear = function(items) {\n triggered = true;\n expect(items).to.deep.equal(objectToAdd);\n };\n\n // this shouldn't invoke the callback\n collection.clear();\n\n expect(triggered).to.equal(false);\n\n collection.bulkAdd(objectToAdd);\n collection.clear();\n\n expect(triggered).to.equal(true);\n\n done();\n });\n});\n"]}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/*!
|
|
4
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview In this file, we will test the functions exported by deep_copy.js
|
|
9
|
-
*/
|
|
10
|
-
const chai_1 = require("chai");
|
|
11
|
-
const index_1 = require("../../index");
|
|
12
|
-
let error;
|
|
13
|
-
describe("BaseDataArray", function () {
|
|
14
|
-
it("should set, insert and remove some values in a (TypedArray) DataArray", function () {
|
|
15
|
-
const myDataArray = new index_1.Int32DataArray(5);
|
|
16
|
-
try {
|
|
17
|
-
myDataArray.set(0, [1, 2, 3, 4, 5]);
|
|
18
|
-
myDataArray.insertRange(2, [31, 32, 33]);
|
|
19
|
-
myDataArray.removeRange(3, 4);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
error = e;
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
chai_1.expect(error).to.equal(undefined);
|
|
26
|
-
chai_1.expect(myDataArray.length).to.equal(4);
|
|
27
|
-
chai_1.expect(Array.prototype.slice.call(myDataArray.getBuffer())).to.deep.equal([1, 2, 31, 5]);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
it("should set, insert and remove some values in a UniversalArray", function () {
|
|
31
|
-
const myDataArray = new index_1.UniversalDataArray(5);
|
|
32
|
-
try {
|
|
33
|
-
console.log("UniversalArray: ", myDataArray);
|
|
34
|
-
myDataArray.set(0, ["1", "2", "3", "4", "5"]);
|
|
35
|
-
myDataArray.insertRange(2, ["31", "32", "33"]);
|
|
36
|
-
myDataArray.removeRange(3, 4);
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
error = e;
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
chai_1.expect(error).to.equal(undefined);
|
|
43
|
-
chai_1.expect(myDataArray.length).to.equal(4);
|
|
44
|
-
chai_1.expect(Array.prototype.slice.call(myDataArray.getBuffer())).to.deep.equal(["1", "2", "31", "5"]);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
it("should get all elements from array", function () {
|
|
48
|
-
const myDataArray = new index_1.Int8DataArray(5);
|
|
49
|
-
myDataArray.set(0, [1, 2, 3, 4, 5]);
|
|
50
|
-
const subArray = myDataArray.getValueRange(0, 5);
|
|
51
|
-
chai_1.expect(subArray.length).to.equal(5);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe("BoolDataArray", function () {
|
|
55
|
-
it("should set, insert and remove some values", function () {
|
|
56
|
-
const myDataArray = new index_1.BoolDataArray(5);
|
|
57
|
-
try {
|
|
58
|
-
myDataArray.set(0, [1, 0, false, 1, true]);
|
|
59
|
-
myDataArray.insertRange(2, [1, 0, false]);
|
|
60
|
-
myDataArray.removeRange(3, 4);
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
error = e;
|
|
64
|
-
}
|
|
65
|
-
finally {
|
|
66
|
-
chai_1.expect(error).to.equal(undefined);
|
|
67
|
-
chai_1.expect(myDataArray.length).to.equal(4);
|
|
68
|
-
chai_1.expect(Array.prototype.slice.call(myDataArray.getBuffer())).to.deep.equal([true, false, true, true]);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
it("should get all elements from array", function () {
|
|
72
|
-
const myDataArray = new index_1.BoolDataArray(5);
|
|
73
|
-
myDataArray.set(0, [true, false, true, false, false]);
|
|
74
|
-
const subArray = myDataArray.getValueRange(1, 4);
|
|
75
|
-
chai_1.expect(subArray.length).to.equal(3);
|
|
76
|
-
chai_1.expect(subArray).to.deep.equal([false, true, false]);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=dataArray.spec.js.map
|