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