@fluid-experimental/property-changeset 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ajvFactory.cjs +19 -0
- package/dist/ajvFactory.cjs.map +1 -0
- package/dist/ajvFactory.d.cts +7 -0
- package/dist/ajvFactory.d.cts.map +1 -0
- package/dist/changeset.d.ts +3 -6
- package/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +75 -75
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +6 -2
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +94 -96
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.d.ts +2 -5
- package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.js +11 -12
- package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/dist/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
- package/dist/changeset_operations/changesetConflictTypes.js +2 -2
- package/dist/changeset_operations/changesetConflictTypes.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts +1 -4
- package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +48 -49
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.d.ts +1 -4
- package/dist/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.js +9 -9
- package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +0 -3
- package/dist/helpers/typeidHelper.d.ts.map +1 -1
- package/dist/helpers/typeidHelper.js +10 -10
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/isReservedKeyword.d.ts.map +1 -1
- package/dist/isReservedKeyword.js +2 -2
- package/dist/isReservedKeyword.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/pathHelper.d.ts +0 -3
- package/dist/pathHelper.d.ts.map +1 -1
- package/dist/pathHelper.js +2 -2
- package/dist/pathHelper.js.map +1 -1
- package/dist/rebase.js +8 -8
- package/dist/rebase.js.map +1 -1
- package/dist/templateSchema.d.ts.map +1 -1
- package/dist/templateSchema.js +2 -2
- package/dist/templateSchema.js.map +1 -1
- package/dist/templateValidator.d.ts +1 -1
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +49 -54
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +34 -36
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/indexedCollection.spec.js +9 -6
- package/dist/test/indexedCollection.spec.js.map +1 -1
- package/dist/test/map.spec.js +4 -4
- package/dist/test/map.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +185 -185
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +5 -5
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/schemaValidator.js +12 -11
- package/dist/test/schemaValidator.js.map +1 -1
- package/dist/test/schemas/badBothPropertiesAndTypeid.js +18 -18
- package/dist/test/schemas/badBothPropertiesAndTypeid.js.map +1 -1
- package/dist/test/schemas/badInvalidSemverInTypeid.js +40 -40
- package/dist/test/schemas/badInvalidSemverInTypeid.js.map +1 -1
- package/dist/test/schemas/badMissingSemverInTypeid.js +40 -40
- package/dist/test/schemas/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/schemas/badNestedProperties.js +40 -40
- package/dist/test/schemas/badNestedProperties.js.map +1 -1
- package/dist/test/schemas/badPrimitiveTypeid.js +25 -25
- package/dist/test/schemas/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/schemas/badVersionedTypeid.js +41 -41
- package/dist/test/schemas/badVersionedTypeid.js.map +1 -1
- package/dist/test/schemas/goodColorPalette.js +15 -15
- package/dist/test/schemas/goodColorPalette.js.map +1 -1
- package/dist/test/schemas/goodDraftAsVersion.js +12 -12
- package/dist/test/schemas/goodDraftAsVersion.js.map +1 -1
- package/dist/test/schemas/goodPointId.js +40 -40
- package/dist/test/schemas/goodPointId.js.map +1 -1
- package/dist/test/schemas/goodReferenceAndRegular.js +16 -16
- package/dist/test/schemas/goodReferenceAndRegular.js.map +1 -1
- package/dist/test/schemas/goodReservedTypes.js +22 -22
- package/dist/test/schemas/goodReservedTypes.js.map +1 -1
- package/dist/test/schemas/goodUIBorder.js +34 -34
- package/dist/test/schemas/goodUIBorder.js.map +1 -1
- package/dist/test/schemas/index.js +55 -0
- package/dist/test/schemas/index.js.map +1 -0
- package/dist/test/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/test/validator/templateSyntax.spec.js +20 -25
- package/dist/test/validator/templateSyntax.spec.js.map +1 -1
- package/dist/test/validator/templateValidator.spec.js +118 -89
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/test/validator/typeidHelper.spec.js +42 -41
- package/dist/test/validator/typeidHelper.spec.js.map +1 -1
- package/dist/utils.d.ts +17 -13
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +79 -79
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts +2 -1
- package/dist/validationResultBuilder.d.ts.map +1 -1
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/ajvFactory.cjs +19 -0
- package/lib/ajvFactory.cjs.map +1 -0
- package/lib/ajvFactory.d.cts +7 -0
- package/lib/ajvFactory.d.cts.map +1 -0
- package/lib/changeset.d.ts +3 -6
- package/lib/changeset.d.ts.map +1 -1
- package/lib/changeset.js +16 -16
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.d.ts +6 -2
- package/lib/changeset_operations/array.d.ts.map +1 -1
- package/lib/changeset_operations/array.js +7 -9
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.d.ts +2 -5
- package/lib/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.js +3 -4
- package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/lib/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
- package/lib/changeset_operations/changesetConflictTypes.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.d.ts +1 -4
- package/lib/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +10 -11
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/changeset_operations/isEmptyChangeset.d.ts +1 -4
- package/lib/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
- package/lib/changeset_operations/isEmptyChangeset.js +3 -3
- package/lib/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/lib/helpers/typeidHelper.d.ts +0 -3
- package/lib/helpers/typeidHelper.d.ts.map +1 -1
- package/lib/helpers/typeidHelper.js +1 -1
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/index.d.ts +8 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -8
- package/lib/index.js.map +1 -1
- package/lib/isReservedKeyword.d.ts.map +1 -1
- package/lib/isReservedKeyword.js.map +1 -1
- package/lib/pathHelper.d.ts +0 -3
- package/lib/pathHelper.d.ts.map +1 -1
- package/lib/pathHelper.js.map +1 -1
- package/lib/rebase.js +2 -2
- package/lib/rebase.js.map +1 -1
- package/lib/templateSchema.d.ts.map +1 -1
- package/lib/templateSchema.js.map +1 -1
- package/lib/templateValidator.d.ts +1 -1
- package/lib/templateValidator.d.ts.map +1 -1
- package/lib/templateValidator.js +24 -29
- package/lib/templateValidator.js.map +1 -1
- package/lib/test/array.spec.js +768 -0
- package/lib/test/array.spec.js.map +1 -0
- package/lib/test/indexedCollection.spec.js +75 -0
- package/lib/test/indexedCollection.spec.js.map +1 -0
- package/lib/test/map.spec.js +17 -0
- package/lib/test/map.spec.js.map +1 -0
- package/lib/test/pathHelper.spec.js +435 -0
- package/lib/test/pathHelper.spec.js.map +1 -0
- package/lib/test/reversibleCs.spec.js +42 -0
- package/lib/test/reversibleCs.spec.js.map +1 -0
- package/lib/test/schemaValidator.js +103 -0
- package/lib/test/schemaValidator.js.map +1 -0
- package/lib/test/schemas/badBothPropertiesAndTypeid.js +24 -0
- package/lib/test/schemas/badBothPropertiesAndTypeid.js.map +1 -0
- package/lib/test/schemas/badInvalidSemverInTypeid.js +46 -0
- package/lib/test/schemas/badInvalidSemverInTypeid.js.map +1 -0
- package/lib/test/schemas/badMissingSemverInTypeid.js +46 -0
- package/lib/test/schemas/badMissingSemverInTypeid.js.map +1 -0
- package/lib/test/schemas/badNestedProperties.js +46 -0
- package/lib/test/schemas/badNestedProperties.js.map +1 -0
- package/lib/test/schemas/badPrimitiveTypeid.js +31 -0
- package/lib/test/schemas/badPrimitiveTypeid.js.map +1 -0
- package/lib/test/schemas/badVersionedTypeid.js +47 -0
- package/lib/test/schemas/badVersionedTypeid.js.map +1 -0
- package/lib/test/schemas/goodColorPalette.js +21 -0
- package/lib/test/schemas/goodColorPalette.js.map +1 -0
- package/lib/test/schemas/goodDraftAsVersion.js +18 -0
- package/lib/test/schemas/goodDraftAsVersion.js.map +1 -0
- package/lib/test/schemas/goodPointId.js +46 -0
- package/lib/test/schemas/goodPointId.js.map +1 -0
- package/lib/test/schemas/goodReferenceAndRegular.js +22 -0
- package/lib/test/schemas/goodReferenceAndRegular.js.map +1 -0
- package/lib/test/schemas/goodReservedTypes.js +29 -0
- package/lib/test/schemas/goodReservedTypes.js.map +1 -0
- package/lib/test/schemas/goodUIBorder.js +41 -0
- package/lib/test/schemas/goodUIBorder.js.map +1 -0
- package/lib/test/schemas/index.js +29 -0
- package/lib/test/schemas/index.js.map +1 -0
- package/lib/test/tsconfig.tsbuildinfo +1 -0
- package/lib/test/validator/templateSyntax.spec.js +83 -0
- package/lib/test/validator/templateSyntax.spec.js.map +1 -0
- package/lib/test/validator/templateValidator.spec.js +1022 -0
- package/lib/test/validator/templateValidator.spec.js.map +1 -0
- package/lib/test/validator/typeidHelper.spec.js +142 -0
- package/lib/test/validator/typeidHelper.spec.js.map +1 -0
- package/lib/utils.d.ts +17 -13
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +23 -23
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.d.ts +2 -1
- package/lib/validationResultBuilder.d.ts.map +1 -1
- package/lib/validationResultBuilder.js.map +1 -1
- package/package.json +37 -16
- package/dist/test/tsconfig.tsbuildinfo +0 -1
|
@@ -8,178 +8,178 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
* @fileoverview In this file, we will test the path helper functions described in /src/properties/path_helper.js
|
|
9
9
|
*/
|
|
10
10
|
const chai_1 = require("chai");
|
|
11
|
-
const
|
|
11
|
+
const pathHelper_js_1 = require("../pathHelper.js");
|
|
12
12
|
describe("PathHelper", function () {
|
|
13
13
|
describe("tokenizePathString", function () {
|
|
14
14
|
it("should work for simple paths separated by dots", function () {
|
|
15
15
|
let types = [];
|
|
16
|
-
(0, chai_1.expect)(
|
|
16
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("", types)).to.deep.equal([]);
|
|
17
17
|
(0, chai_1.expect)(types).to.deep.equal([]);
|
|
18
|
-
(0, chai_1.expect)(
|
|
19
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
20
|
-
(0, chai_1.expect)(
|
|
18
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("test", types)).to.deep.equal(["test"]);
|
|
19
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN]);
|
|
20
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("test.test2", types)).to.deep.equal([
|
|
21
21
|
"test",
|
|
22
22
|
"test2",
|
|
23
23
|
]);
|
|
24
24
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
26
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
27
27
|
]);
|
|
28
28
|
(0, chai_1.expect)(function () {
|
|
29
|
-
|
|
29
|
+
pathHelper_js_1.PathHelper.tokenizePathString(".test2");
|
|
30
30
|
}).to.throw();
|
|
31
31
|
(0, chai_1.expect)(function () {
|
|
32
|
-
|
|
32
|
+
pathHelper_js_1.PathHelper.tokenizePathString("test2.");
|
|
33
33
|
}).to.throw();
|
|
34
34
|
(0, chai_1.expect)(function () {
|
|
35
|
-
|
|
35
|
+
pathHelper_js_1.PathHelper.tokenizePathString(".");
|
|
36
36
|
}).to.throw();
|
|
37
37
|
});
|
|
38
38
|
it("should work for arrays", function () {
|
|
39
39
|
let types = [];
|
|
40
|
-
(0, chai_1.expect)(
|
|
41
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
42
|
-
(0, chai_1.expect)(
|
|
40
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("[test]", types)).to.deep.equal(["test"]);
|
|
41
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN]);
|
|
42
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("[test][test2]", types)).to.deep.equal([
|
|
43
43
|
"test",
|
|
44
44
|
"test2",
|
|
45
45
|
]);
|
|
46
46
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
48
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
49
49
|
]);
|
|
50
50
|
(0, chai_1.expect)(function () {
|
|
51
|
-
|
|
51
|
+
pathHelper_js_1.PathHelper.tokenizePathString("[");
|
|
52
52
|
}).to.throw();
|
|
53
53
|
(0, chai_1.expect)(function () {
|
|
54
|
-
|
|
54
|
+
pathHelper_js_1.PathHelper.tokenizePathString("[abcd");
|
|
55
55
|
}).to.throw();
|
|
56
56
|
(0, chai_1.expect)(function () {
|
|
57
|
-
|
|
57
|
+
pathHelper_js_1.PathHelper.tokenizePathString("]");
|
|
58
58
|
}).to.throw();
|
|
59
59
|
(0, chai_1.expect)(function () {
|
|
60
|
-
|
|
60
|
+
pathHelper_js_1.PathHelper.tokenizePathString("[abcd]]");
|
|
61
61
|
}).to.throw();
|
|
62
62
|
(0, chai_1.expect)(function () {
|
|
63
|
-
|
|
63
|
+
pathHelper_js_1.PathHelper.tokenizePathString("[]");
|
|
64
64
|
}).to.throw();
|
|
65
65
|
});
|
|
66
66
|
it("should work for combinations of arrays and paths separated by dots", function () {
|
|
67
67
|
let types = [];
|
|
68
|
-
(0, chai_1.expect)(
|
|
68
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("map[test]", types)).to.deep.equal([
|
|
69
69
|
"map",
|
|
70
70
|
"test",
|
|
71
71
|
]);
|
|
72
72
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
74
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
75
75
|
]);
|
|
76
|
-
(0, chai_1.expect)(
|
|
76
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("[test].parameter", types)).to.deep.equal([
|
|
77
77
|
"test",
|
|
78
78
|
"parameter",
|
|
79
79
|
]);
|
|
80
80
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
82
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
83
83
|
]);
|
|
84
|
-
(0, chai_1.expect)(
|
|
84
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("map[test].parameter[test2]", types)).to.deep.equal(["map", "test", "parameter", "test2"]);
|
|
85
85
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
87
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
88
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
89
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
90
90
|
]);
|
|
91
91
|
(0, chai_1.expect)(function () {
|
|
92
|
-
|
|
92
|
+
pathHelper_js_1.PathHelper.tokenizePathString("[test]parameter");
|
|
93
93
|
}).to.throw();
|
|
94
94
|
});
|
|
95
95
|
it("should work for quoted tokens", function () {
|
|
96
96
|
let types = [];
|
|
97
|
-
(0, chai_1.expect)(
|
|
98
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
99
|
-
(0, chai_1.expect)(
|
|
100
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
101
|
-
(0, chai_1.expect)(
|
|
102
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
103
|
-
(0, chai_1.expect)(
|
|
104
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
105
|
-
(0, chai_1.expect)(
|
|
97
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"test"', types)).to.deep.equal(["test"]);
|
|
98
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN]);
|
|
99
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"te\\"st"', types)).to.deep.equal(['te"st']);
|
|
100
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN]);
|
|
101
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"te\\\\st"', types)).to.deep.equal(["te\\st"]);
|
|
102
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN]);
|
|
103
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('""', types)).to.deep.equal([""]);
|
|
104
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN]);
|
|
105
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"test1".test2', types)).to.deep.equal([
|
|
106
106
|
"test1",
|
|
107
107
|
"test2",
|
|
108
108
|
]);
|
|
109
109
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
111
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
112
112
|
]);
|
|
113
|
-
(0, chai_1.expect)(
|
|
113
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"test1"."test2"', types)).to.deep.equal([
|
|
114
114
|
"test1",
|
|
115
115
|
"test2",
|
|
116
116
|
]);
|
|
117
117
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
119
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
120
120
|
]);
|
|
121
|
-
(0, chai_1.expect)(
|
|
121
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('test1."test2"', types)).to.deep.equal([
|
|
122
122
|
"test1",
|
|
123
123
|
"test2",
|
|
124
124
|
]);
|
|
125
125
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
127
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
128
128
|
]);
|
|
129
|
-
(0, chai_1.expect)(
|
|
129
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('test1["test2"]', types)).to.deep.equal([
|
|
130
130
|
"test1",
|
|
131
131
|
"test2",
|
|
132
132
|
]);
|
|
133
133
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
135
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
136
136
|
]);
|
|
137
|
-
(0, chai_1.expect)(
|
|
137
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"test1"["test2"]', types)).to.deep.equal([
|
|
138
138
|
"test1",
|
|
139
139
|
"test2",
|
|
140
140
|
]);
|
|
141
141
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
143
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
144
144
|
]);
|
|
145
|
-
(0, chai_1.expect)(
|
|
145
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('""[""]', types)).to.deep.equal(["", ""]);
|
|
146
146
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
]);
|
|
150
|
-
(0, chai_1.expect)(
|
|
151
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
152
|
-
(0, chai_1.expect)(
|
|
153
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
154
|
-
(0, chai_1.expect)(
|
|
147
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
148
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
149
|
+
]);
|
|
150
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString('"/"', types)).to.deep.equal(["/"]);
|
|
151
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN]);
|
|
152
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("/", types)).to.deep.equal(["/"]);
|
|
153
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_ROOT_TOKEN]);
|
|
154
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("/test", types)).to.deep.equal(["/", "test"]);
|
|
155
155
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_ROOT_TOKEN,
|
|
157
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
158
158
|
]);
|
|
159
|
-
(0, chai_1.expect)(
|
|
159
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("/[test]", types)).to.deep.equal(["/", "test"]);
|
|
160
160
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_ROOT_TOKEN,
|
|
162
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
163
163
|
]);
|
|
164
|
-
(0, chai_1.expect)(
|
|
165
|
-
(0, chai_1.expect)(types).to.deep.equal([
|
|
166
|
-
(0, chai_1.expect)(
|
|
164
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("*", types)).to.deep.equal(["*"]);
|
|
165
|
+
(0, chai_1.expect)(types).to.deep.equal([pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN]);
|
|
166
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("test*", types)).to.deep.equal(["test", "*"]);
|
|
167
167
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
169
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
170
170
|
]);
|
|
171
|
-
(0, chai_1.expect)(
|
|
171
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("*.test", types)).to.deep.equal(["*", "test"]);
|
|
172
172
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
174
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
175
175
|
]);
|
|
176
176
|
(0, chai_1.expect)(function () {
|
|
177
|
-
|
|
177
|
+
pathHelper_js_1.PathHelper.tokenizePathString("*test", types);
|
|
178
178
|
}).to.throw();
|
|
179
179
|
(0, chai_1.expect)(function () {
|
|
180
|
-
|
|
180
|
+
pathHelper_js_1.PathHelper.tokenizePathString("test*test", types);
|
|
181
181
|
}).to.throw();
|
|
182
|
-
(0, chai_1.expect)(
|
|
182
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("*.test*.test2*", types)).to.deep.equal([
|
|
183
183
|
"*",
|
|
184
184
|
"test",
|
|
185
185
|
"*",
|
|
@@ -187,83 +187,83 @@ describe("PathHelper", function () {
|
|
|
187
187
|
"*",
|
|
188
188
|
]);
|
|
189
189
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
191
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
192
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
193
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
194
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
195
195
|
]);
|
|
196
|
-
(0, chai_1.expect)(
|
|
196
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("/*", types)).to.deep.equal(["/", "*"]);
|
|
197
197
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_ROOT_TOKEN,
|
|
199
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
200
200
|
]);
|
|
201
|
-
(0, chai_1.expect)(
|
|
201
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("*[test]", types)).to.deep.equal(["*", "test"]);
|
|
202
202
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
204
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
205
205
|
]);
|
|
206
|
-
(0, chai_1.expect)(
|
|
206
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("[test]*", types)).to.deep.equal(["test", "*"]);
|
|
207
207
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
209
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
210
210
|
]);
|
|
211
|
-
(0, chai_1.expect)(
|
|
211
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("[test]*.test2", types)).to.deep.equal([
|
|
212
212
|
"test",
|
|
213
213
|
"*",
|
|
214
214
|
"test2",
|
|
215
215
|
]);
|
|
216
216
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
218
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
219
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
220
220
|
]);
|
|
221
|
-
(0, chai_1.expect)(
|
|
221
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("[test]*[test2]", types)).to.deep.equal([
|
|
222
222
|
"test",
|
|
223
223
|
"*",
|
|
224
224
|
"test2",
|
|
225
225
|
]);
|
|
226
226
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
228
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN,
|
|
229
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
230
230
|
]);
|
|
231
231
|
(0, chai_1.expect)(function () {
|
|
232
|
-
|
|
232
|
+
pathHelper_js_1.PathHelper.tokenizePathString("[test]*test", types);
|
|
233
233
|
}).to.throw();
|
|
234
234
|
(0, chai_1.expect)(function () {
|
|
235
|
-
|
|
235
|
+
pathHelper_js_1.PathHelper.tokenizePathString('"');
|
|
236
236
|
}).to.throw();
|
|
237
237
|
(0, chai_1.expect)(function () {
|
|
238
|
-
|
|
238
|
+
pathHelper_js_1.PathHelper.tokenizePathString('test"');
|
|
239
239
|
}).to.throw();
|
|
240
240
|
(0, chai_1.expect)(function () {
|
|
241
|
-
|
|
241
|
+
pathHelper_js_1.PathHelper.tokenizePathString('"tests');
|
|
242
242
|
}).to.throw();
|
|
243
243
|
(0, chai_1.expect)(function () {
|
|
244
|
-
|
|
244
|
+
pathHelper_js_1.PathHelper.tokenizePathString('"\\a"');
|
|
245
245
|
}).to.throw();
|
|
246
246
|
});
|
|
247
247
|
it("should work for relative paths", function () {
|
|
248
248
|
let types = [];
|
|
249
|
-
(0, chai_1.expect)(
|
|
249
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("../test", types)).to.deep.equal(["../", "test"]);
|
|
250
250
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.RAISE_LEVEL_TOKEN,
|
|
252
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
253
253
|
]);
|
|
254
|
-
(0, chai_1.expect)(
|
|
254
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("../../../test", types)).to.deep.equal([
|
|
255
255
|
"../",
|
|
256
256
|
"../",
|
|
257
257
|
"../",
|
|
258
258
|
"test",
|
|
259
259
|
]);
|
|
260
260
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.RAISE_LEVEL_TOKEN,
|
|
262
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.RAISE_LEVEL_TOKEN,
|
|
263
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.RAISE_LEVEL_TOKEN,
|
|
264
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
265
265
|
]);
|
|
266
|
-
(0, chai_1.expect)(
|
|
266
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.tokenizePathString("../../test[0].test2[key]", types)).to.deep.equal([
|
|
267
267
|
"../",
|
|
268
268
|
"../",
|
|
269
269
|
"test",
|
|
@@ -272,107 +272,107 @@ describe("PathHelper", function () {
|
|
|
272
272
|
"key",
|
|
273
273
|
]);
|
|
274
274
|
(0, chai_1.expect)(types).to.deep.equal([
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
275
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.RAISE_LEVEL_TOKEN,
|
|
276
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.RAISE_LEVEL_TOKEN,
|
|
277
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
278
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
279
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN,
|
|
280
|
+
pathHelper_js_1.PathHelper.TOKEN_TYPES.ARRAY_TOKEN,
|
|
281
281
|
]);
|
|
282
282
|
(0, chai_1.expect)(function () {
|
|
283
|
-
|
|
283
|
+
pathHelper_js_1.PathHelper.tokenizePathString("/../test2");
|
|
284
284
|
}).to.throw();
|
|
285
285
|
});
|
|
286
286
|
});
|
|
287
287
|
describe("quotePathSegment", function () {
|
|
288
288
|
it("should quote simple strings", function () {
|
|
289
|
-
(0, chai_1.expect)(
|
|
290
|
-
(0, chai_1.expect)(JSON.parse(
|
|
289
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegment("test")).to.equal('"test"');
|
|
290
|
+
(0, chai_1.expect)(JSON.parse(pathHelper_js_1.PathHelper.quotePathSegment("test"))).to.equal("test");
|
|
291
291
|
});
|
|
292
292
|
it("should correctly quote strings with a quotation mark", function () {
|
|
293
|
-
(0, chai_1.expect)(
|
|
294
|
-
(0, chai_1.expect)(JSON.parse(
|
|
293
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegment('"')).to.equal('"\\""');
|
|
294
|
+
(0, chai_1.expect)(JSON.parse(pathHelper_js_1.PathHelper.quotePathSegment('"'))).to.equal('"');
|
|
295
295
|
});
|
|
296
296
|
it("should correctly quote strings with a backslash", function () {
|
|
297
|
-
(0, chai_1.expect)(
|
|
298
|
-
(0, chai_1.expect)(JSON.parse(
|
|
297
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegment("\\")).to.equal('"\\\\"');
|
|
298
|
+
(0, chai_1.expect)(JSON.parse(pathHelper_js_1.PathHelper.quotePathSegment("\\"))).to.equal("\\");
|
|
299
299
|
});
|
|
300
300
|
it("should work for paths with multiple occurrences of the test string", function () {
|
|
301
|
-
(0, chai_1.expect)(
|
|
302
|
-
(0, chai_1.expect)(
|
|
303
|
-
(0, chai_1.expect)(
|
|
301
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegment('test"property"')).to.equal('"test\\"property\\""');
|
|
302
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegment("test\\property\\")).to.equal('"test\\\\property\\\\"');
|
|
303
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegment('test"\\property\\"')).to.equal('"test\\"\\\\property\\\\\\""');
|
|
304
304
|
});
|
|
305
305
|
});
|
|
306
306
|
describe("quotePathSegmentIfNeeded", function () {
|
|
307
307
|
it("should quote all required strings", function () {
|
|
308
|
-
(0, chai_1.expect)(
|
|
309
|
-
(0, chai_1.expect)(
|
|
310
|
-
(0, chai_1.expect)(
|
|
311
|
-
(0, chai_1.expect)(
|
|
312
|
-
(0, chai_1.expect)(
|
|
313
|
-
(0, chai_1.expect)(
|
|
314
|
-
(0, chai_1.expect)(
|
|
315
|
-
(0, chai_1.expect)(
|
|
308
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded(".")).to.equal('"."');
|
|
309
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded('"')).to.equal('"\\""');
|
|
310
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("\\")).to.equal('"\\\\"');
|
|
311
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("[")).to.equal('"["');
|
|
312
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("]")).to.equal('"]"');
|
|
313
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("")).to.equal('""');
|
|
314
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("/")).to.equal('"/"');
|
|
315
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("*")).to.equal('"*"');
|
|
316
316
|
});
|
|
317
317
|
it("should not quote other strings", function () {
|
|
318
|
-
(0, chai_1.expect)(
|
|
319
|
-
(0, chai_1.expect)(
|
|
318
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("abcd")).to.equal("abcd");
|
|
319
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded("test_string")).to.equal("test_string");
|
|
320
320
|
});
|
|
321
321
|
});
|
|
322
322
|
describe("unquotePathSegment", function () {
|
|
323
323
|
it("should unquote simple strings", function () {
|
|
324
|
-
(0, chai_1.expect)(
|
|
324
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment('"test"')).to.equal("test");
|
|
325
325
|
});
|
|
326
326
|
it("should correctly unquote strings with a quotation mark", function () {
|
|
327
|
-
(0, chai_1.expect)(
|
|
327
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment('"\\""')).to.equal('"');
|
|
328
328
|
});
|
|
329
329
|
it("should correctly unquote strings with a backslash", function () {
|
|
330
|
-
(0, chai_1.expect)(
|
|
330
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment('"\\\\"')).to.equal("\\");
|
|
331
331
|
});
|
|
332
332
|
it("should work with empty strings", function () {
|
|
333
|
-
(0, chai_1.expect)(
|
|
333
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment("")).to.equal("");
|
|
334
334
|
});
|
|
335
335
|
it("should throw on non strings", function () {
|
|
336
336
|
// @ts-ignore
|
|
337
|
-
(0, chai_1.expect)(() =>
|
|
337
|
+
(0, chai_1.expect)(() => pathHelper_js_1.PathHelper.unquotePathSegment(5)).to.throw();
|
|
338
338
|
});
|
|
339
339
|
it("should work for paths with multiple occurrences of the test string", function () {
|
|
340
|
-
(0, chai_1.expect)(
|
|
341
|
-
(0, chai_1.expect)(
|
|
342
|
-
(0, chai_1.expect)(
|
|
340
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment('"test\\"property\\""')).to.equal('test"property"');
|
|
341
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment('"test\\\\property\\\\"')).to.equal("test\\property\\");
|
|
342
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.unquotePathSegment('"test\\"\\\\property\\\\\\""')).to.equal('test"\\property\\"');
|
|
343
343
|
});
|
|
344
344
|
});
|
|
345
345
|
describe("convertAbsolutePathToCanonical", function () {
|
|
346
346
|
it("should remove leading /", function () {
|
|
347
|
-
(0, chai_1.expect)(
|
|
347
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("/a.b.c")).to.equal("a.b.c");
|
|
348
348
|
});
|
|
349
349
|
it("should throw on ../", function () {
|
|
350
|
-
(0, chai_1.expect)(() =>
|
|
350
|
+
(0, chai_1.expect)(() => pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("../a.b.c")).to.throw("../");
|
|
351
351
|
});
|
|
352
352
|
it("should throw on *", function () {
|
|
353
|
-
(0, chai_1.expect)(() =>
|
|
353
|
+
(0, chai_1.expect)(() => pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("/a.b.c*")).to.throw("*");
|
|
354
354
|
});
|
|
355
355
|
it("should replace square brackets by periods", function () {
|
|
356
|
-
(0, chai_1.expect)(
|
|
357
|
-
(0, chai_1.expect)(
|
|
356
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("/a.b[c]")).to.equal("a.b.c");
|
|
357
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("/a[b].c")).to.equal("a.b.c");
|
|
358
358
|
});
|
|
359
359
|
it("should keep properly escaped property names", function () {
|
|
360
|
-
(0, chai_1.expect)(
|
|
361
|
-
(0, chai_1.expect)(
|
|
362
|
-
(0, chai_1.expect)(
|
|
363
|
-
(0, chai_1.expect)(
|
|
364
|
-
(0, chai_1.expect)(
|
|
365
|
-
(0, chai_1.expect)(
|
|
366
|
-
(0, chai_1.expect)(
|
|
367
|
-
(0, chai_1.expect)(
|
|
360
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"."')).to.equal('"."');
|
|
361
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"\\""')).to.equal('"\\""');
|
|
362
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"\\\\"')).to.equal('"\\\\"');
|
|
363
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"["')).to.equal('"["');
|
|
364
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"]"')).to.equal('"]"');
|
|
365
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('""')).to.equal('""');
|
|
366
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"/"')).to.equal('"/"');
|
|
367
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"*"')).to.equal('"*"');
|
|
368
368
|
});
|
|
369
369
|
it("should properly unescape unusually escaped property names", function () {
|
|
370
|
-
(0, chai_1.expect)(
|
|
371
|
-
(0, chai_1.expect)(
|
|
370
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"a"."b"')).to.equal("a.b");
|
|
371
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical('"a"[b]["c"]')).to.equal("a.b.c");
|
|
372
372
|
});
|
|
373
373
|
it("should not modify simple paths", function () {
|
|
374
|
-
(0, chai_1.expect)(
|
|
375
|
-
(0, chai_1.expect)(
|
|
374
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("a.b.c.d")).to.equal("a.b.c.d");
|
|
375
|
+
(0, chai_1.expect)(pathHelper_js_1.PathHelper.convertAbsolutePathToCanonical("test_string")).to.equal("test_string");
|
|
376
376
|
});
|
|
377
377
|
});
|
|
378
378
|
describe("getPathCoverage", function () {
|
|
@@ -380,56 +380,56 @@ describe("PathHelper", function () {
|
|
|
380
380
|
let paths;
|
|
381
381
|
it("should succeed if property is included in a path 1", function () {
|
|
382
382
|
paths = ["a.b"];
|
|
383
|
-
const res =
|
|
384
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
383
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.b", paths);
|
|
384
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.FULLY_COVERED);
|
|
385
385
|
(0, chai_1.expect)(res.pathList).to.deep.equal(["a.b"]);
|
|
386
386
|
});
|
|
387
387
|
it("should succeed if property is included in a path 2", function () {
|
|
388
388
|
paths = ["a.b"];
|
|
389
|
-
const res =
|
|
390
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
389
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.b.c", paths);
|
|
390
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.FULLY_COVERED);
|
|
391
391
|
(0, chai_1.expect)(res.pathList).to.deep.equal(["a.b"]);
|
|
392
392
|
});
|
|
393
393
|
it("should succeed if property is included in a path 3", function () {
|
|
394
394
|
paths = ["a.b"];
|
|
395
|
-
const res =
|
|
396
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
395
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.b.c.d", paths);
|
|
396
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.FULLY_COVERED);
|
|
397
397
|
(0, chai_1.expect)(res.pathList).to.deep.equal(["a.b"]);
|
|
398
398
|
});
|
|
399
399
|
it("should fail if property is not included in any path 1", function () {
|
|
400
400
|
paths = ["a.b"];
|
|
401
|
-
const res =
|
|
402
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
401
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("b", paths);
|
|
402
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.UNCOVERED);
|
|
403
403
|
(0, chai_1.expect)(res.pathList).to.deep.equal([]);
|
|
404
404
|
});
|
|
405
405
|
it("should fail if property is not included in any path 2", function () {
|
|
406
406
|
paths = ["a.b"];
|
|
407
|
-
const res =
|
|
408
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
407
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("b.f.g", paths);
|
|
408
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.UNCOVERED);
|
|
409
409
|
(0, chai_1.expect)(res.pathList).to.deep.equal([]);
|
|
410
410
|
});
|
|
411
411
|
it("should fail if property is not included in any path but have common root 1", function () {
|
|
412
412
|
paths = ["a.b"];
|
|
413
|
-
const res =
|
|
414
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
413
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.h", paths);
|
|
414
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.UNCOVERED);
|
|
415
415
|
(0, chai_1.expect)(res.pathList).to.deep.equal([]);
|
|
416
416
|
});
|
|
417
417
|
it("should fail if property is not included in any path but have common root 2", function () {
|
|
418
418
|
paths = ["a.b"];
|
|
419
|
-
const res =
|
|
420
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
419
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.i.j", paths);
|
|
420
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.UNCOVERED);
|
|
421
421
|
(0, chai_1.expect)(res.pathList).to.deep.equal([]);
|
|
422
422
|
});
|
|
423
423
|
it("should succeed if path goes through the property 1", function () {
|
|
424
424
|
paths = ["a.b.c", "a.b.d", "z"];
|
|
425
|
-
const res =
|
|
426
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
425
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.b", paths);
|
|
426
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.PARTLY_COVERED);
|
|
427
427
|
(0, chai_1.expect)(res.pathList).to.deep.equal(["a.b.c", "a.b.d"]);
|
|
428
428
|
});
|
|
429
429
|
it("should succeed if path goes through the property 2", function () {
|
|
430
430
|
paths = ["z", "a.b.c", "a.b.d"];
|
|
431
|
-
const res =
|
|
432
|
-
(0, chai_1.expect)(res.coverageExtent).to.equal(
|
|
431
|
+
const res = pathHelper_js_1.PathHelper.getPathCoverage("a.b", paths);
|
|
432
|
+
(0, chai_1.expect)(res.coverageExtent).to.equal(pathHelper_js_1.PathHelper.CoverageExtent.PARTLY_COVERED);
|
|
433
433
|
(0, chai_1.expect)(res.pathList).to.deep.equal(["a.b.c", "a.b.d"]);
|
|
434
434
|
});
|
|
435
435
|
});
|