@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
|
@@ -3,34 +3,63 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
/* eslint no-unused-expressions: 0 */
|
|
11
|
+
// Lint disable to avoid needing to place `async` on many test functions
|
|
12
|
+
// as validity of testing is in general questionable and trying to avoid
|
|
13
|
+
// changes.
|
|
14
|
+
/* eslint-disable @typescript-eslint/promise-function-async */
|
|
8
15
|
/**
|
|
9
16
|
* @fileoverview In this file, we will test template validation.
|
|
10
17
|
*/
|
|
18
|
+
const property_common_1 = require("@fluid-experimental/property-common");
|
|
11
19
|
const chai_1 = require("chai");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
20
|
+
const semver_1 = __importDefault(require("semver"));
|
|
21
|
+
const templateValidator_js_1 = require("../../templateValidator.js");
|
|
22
|
+
const schemaValidator_js_1 = require("../schemaValidator.js");
|
|
23
|
+
const index_js_1 = require("../schemas/index.js");
|
|
14
24
|
(function () {
|
|
15
|
-
|
|
16
|
-
let semver = require("semver");
|
|
25
|
+
const MSG = property_common_1.constants.MSG;
|
|
17
26
|
const performValidation = function (async, template, templatePrevious, skipSemver, asyncErrorMessage) {
|
|
18
|
-
let schemaValidator = new
|
|
27
|
+
let schemaValidator = new schemaValidator_js_1.SchemaValidator();
|
|
28
|
+
// @ts-expect-error - per the catch and no throw below
|
|
19
29
|
return async
|
|
20
30
|
? schemaValidator
|
|
21
31
|
.validate(template, templatePrevious, async, skipSemver)
|
|
22
32
|
.catch((error) => {
|
|
23
33
|
(0, chai_1.expect)(error.message).to.have.string(asyncErrorMessage);
|
|
34
|
+
// This really should re-throw the error. As it stands this
|
|
35
|
+
// catch returns `undefined` which is not SchemaValidationResult.
|
|
36
|
+
// Throwing will cause "fail: previous template: invalid semver"
|
|
37
|
+
// test case to fail with uncaught error.
|
|
38
|
+
// This also has impact on the malformed validate function below.
|
|
39
|
+
// throw error;
|
|
24
40
|
})
|
|
25
|
-
:
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
: // A better pattern is simply Promise.resolve(...). However without all callers
|
|
42
|
+
// properly specifying they are `async` (lint disabled for file), they may fail.
|
|
43
|
+
// In particular see test case
|
|
44
|
+
// "should fail if map with context key type typeid is not constant"
|
|
45
|
+
new Promise((resolve) => {
|
|
46
|
+
resolve(schemaValidator.validate(template, templatePrevious, async, skipSemver));
|
|
47
|
+
});
|
|
28
48
|
};
|
|
29
49
|
// Performs both synchronous and asynchronous validation
|
|
30
50
|
let validate = function (expectations, template, templatePrevious, skipSemver, asyncErrorMessage) {
|
|
31
51
|
return performValidation(false, template, templatePrevious, skipSemver)
|
|
32
52
|
.then(expectations)
|
|
33
|
-
.then(
|
|
53
|
+
.then(
|
|
54
|
+
// This patten is invalid. The `then` parameter is expected to be callable.
|
|
55
|
+
// Instead performValidation is called and its result is is called. Or at least
|
|
56
|
+
// should be. As set up the following .then is executed (apparently) on the
|
|
57
|
+
// results of the prior performValidation. This could be address with this prefix:
|
|
58
|
+
// async () =>
|
|
59
|
+
// However doing so causes tests to fail. Testing coming through here appears
|
|
60
|
+
// invalid.
|
|
61
|
+
// @ts-expect-error
|
|
62
|
+
performValidation(true, template, templatePrevious, skipSemver, asyncErrorMessage))
|
|
34
63
|
.then(expectations);
|
|
35
64
|
};
|
|
36
65
|
describe("Template Validation", function () {
|
|
@@ -58,7 +87,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
58
87
|
// --- TYPEID ---
|
|
59
88
|
describe("typeid validation", function () {
|
|
60
89
|
it("pass: valid typeid", function () {
|
|
61
|
-
let template = JSON.parse(JSON.stringify(
|
|
90
|
+
let template = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
62
91
|
let expectations = function (result) {
|
|
63
92
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
64
93
|
(0, chai_1.expect)(result.typeid).to.equal(template.typeid);
|
|
@@ -69,7 +98,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
69
98
|
return validate(expectations, template);
|
|
70
99
|
});
|
|
71
100
|
it("fail: missing semver", function () {
|
|
72
|
-
let template = JSON.parse(JSON.stringify(
|
|
101
|
+
let template = JSON.parse(JSON.stringify(index_js_1.badMissingSemverInTypeid.templateSchema));
|
|
73
102
|
let expectations = function (result) {
|
|
74
103
|
(0, chai_1.expect)(result).property("isValid", false);
|
|
75
104
|
(0, chai_1.expect)(result.typeid).to.equal(template.typeid);
|
|
@@ -81,7 +110,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
81
110
|
return validate(expectations, template);
|
|
82
111
|
});
|
|
83
112
|
it("fail: invalid semver 1", function () {
|
|
84
|
-
let template = JSON.parse(JSON.stringify(
|
|
113
|
+
let template = JSON.parse(JSON.stringify(index_js_1.badInvalidSemverInTypeid.templateSchema));
|
|
85
114
|
let expectations = function (result) {
|
|
86
115
|
(0, chai_1.expect)(result).property("isValid", false);
|
|
87
116
|
(0, chai_1.expect)(result.typeid).to.equal(template.typeid);
|
|
@@ -92,7 +121,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
92
121
|
return validate(expectations, template);
|
|
93
122
|
});
|
|
94
123
|
it("fail: invalid semver 2", function () {
|
|
95
|
-
let template = JSON.parse(JSON.stringify(
|
|
124
|
+
let template = JSON.parse(JSON.stringify(index_js_1.badInvalidSemverInTypeid.templateSchema));
|
|
96
125
|
template.typeid = "TeamLeoValidation2:PointID-1.0.01";
|
|
97
126
|
let expectations = function (result) {
|
|
98
127
|
(0, chai_1.expect)(result).property("isValid", false);
|
|
@@ -104,7 +133,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
104
133
|
return validate(expectations, template);
|
|
105
134
|
});
|
|
106
135
|
it("fail: previous template: invalid semver", function () {
|
|
107
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
136
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
108
137
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
109
138
|
let badTypeId = "TeamLeoValidation2:PointID-1.0.0.1";
|
|
110
139
|
templatePrevious.typeid = badTypeId;
|
|
@@ -121,7 +150,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
121
150
|
// --- Template versioning ---
|
|
122
151
|
describe("template versioning", function () {
|
|
123
152
|
it("fail: version regression: 1.0.0 -> 0.9.9", function () {
|
|
124
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
153
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
125
154
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
126
155
|
template.typeid = "TeamLeoValidation2:PointID-0.9.9";
|
|
127
156
|
let expectations = function (result) {
|
|
@@ -134,7 +163,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
134
163
|
});
|
|
135
164
|
describe("same version", function () {
|
|
136
165
|
it("pass: same content", function () {
|
|
137
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
166
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
138
167
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
139
168
|
let expectations = function (result) {
|
|
140
169
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -145,7 +174,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
145
174
|
return validate(expectations, template, templatePrevious);
|
|
146
175
|
});
|
|
147
176
|
it("fail: changed 'annotation'", function () {
|
|
148
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
177
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
149
178
|
templatePrevious.annotation = { description: "Test" };
|
|
150
179
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
151
180
|
template.annotation.description = "Changed!";
|
|
@@ -158,7 +187,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
158
187
|
return validate(expectations, template, templatePrevious);
|
|
159
188
|
});
|
|
160
189
|
it("fail: deleted 'annotation'", function () {
|
|
161
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
190
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
162
191
|
templatePrevious.annotation = { description: "Test" };
|
|
163
192
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
164
193
|
delete template.annotation;
|
|
@@ -171,7 +200,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
171
200
|
return validate(expectations, template, templatePrevious);
|
|
172
201
|
});
|
|
173
202
|
it("fail: added 'annotation'", function () {
|
|
174
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
203
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
175
204
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
176
205
|
template.annotation = { description: "Test" };
|
|
177
206
|
let expectations = function (result) {
|
|
@@ -183,7 +212,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
183
212
|
return validate(expectations, template, templatePrevious);
|
|
184
213
|
});
|
|
185
214
|
it("fail: changed 'value'", function () {
|
|
186
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
215
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodUIBorder.templateSchema));
|
|
187
216
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
188
217
|
template.properties[0].properties[0].value = 123456;
|
|
189
218
|
let expectations = function (result) {
|
|
@@ -195,7 +224,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
195
224
|
return validate(expectations, template, templatePrevious);
|
|
196
225
|
});
|
|
197
226
|
it("fail: changed 'id'", function () {
|
|
198
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
227
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
199
228
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
200
229
|
template.properties[0].properties[0].id = "xx";
|
|
201
230
|
let expectations = function (result) {
|
|
@@ -207,7 +236,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
207
236
|
return validate(expectations, template, templatePrevious);
|
|
208
237
|
});
|
|
209
238
|
it("fail: changed 'inherits'", function () {
|
|
210
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
239
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodReservedTypes.templateSchema));
|
|
211
240
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
212
241
|
template.inherits = "Reference<Adsk.Core:Math.Color-1.0.0>";
|
|
213
242
|
let expectations = function (result) {
|
|
@@ -219,7 +248,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
219
248
|
return validate(expectations, template, templatePrevious);
|
|
220
249
|
});
|
|
221
250
|
it("fail: added property", function () {
|
|
222
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
251
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
223
252
|
templatePrevious.annotation = { description: "Test" };
|
|
224
253
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
225
254
|
template.properties[0].properties.push({ id: "newPropId", typeid: "Float32" });
|
|
@@ -232,7 +261,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
232
261
|
return validate(expectations, template, templatePrevious);
|
|
233
262
|
});
|
|
234
263
|
it("fail: deleted property", function () {
|
|
235
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
264
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
236
265
|
templatePrevious.annotation = { description: "Test" };
|
|
237
266
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
238
267
|
template.properties[0].properties.pop();
|
|
@@ -247,9 +276,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
247
276
|
});
|
|
248
277
|
describe("incremented patch level", function () {
|
|
249
278
|
it("pass: same content", function () {
|
|
250
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
279
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
251
280
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
252
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
281
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
253
282
|
let expectations = function (result) {
|
|
254
283
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
255
284
|
(0, chai_1.expect)(result.errors).to.be.empty;
|
|
@@ -259,7 +288,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
259
288
|
return validate(expectations, template, templatePrevious);
|
|
260
289
|
});
|
|
261
290
|
it("pass: unstable with major content change: 0.0.1 -> 0.0.2", function () {
|
|
262
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
291
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
263
292
|
templatePrevious.typeid = "TeamLeoValidation2:PointID-0.0.1";
|
|
264
293
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
265
294
|
template.typeid = "TeamLeoValidation2:PointID-0.0.2";
|
|
@@ -273,10 +302,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
273
302
|
return validate(expectations, template, templatePrevious);
|
|
274
303
|
});
|
|
275
304
|
it("pass: changed 'annotation'", function () {
|
|
276
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
305
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
277
306
|
templatePrevious.annotation = { description: "Test" };
|
|
278
307
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
279
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
308
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
280
309
|
template.annotation.description = "Changed!";
|
|
281
310
|
let expectations = function (result) {
|
|
282
311
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -287,10 +316,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
287
316
|
return validate(expectations, template, templatePrevious);
|
|
288
317
|
});
|
|
289
318
|
it("pass: deleted 'annotation'", function () {
|
|
290
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
319
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
291
320
|
templatePrevious.annotation = { description: "Test" };
|
|
292
321
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
293
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
322
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
294
323
|
delete template.annotation;
|
|
295
324
|
let expectations = function (result) {
|
|
296
325
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -301,9 +330,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
301
330
|
return validate(expectations, template, templatePrevious);
|
|
302
331
|
});
|
|
303
332
|
it("pass: added 'annotation'", function () {
|
|
304
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
333
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
305
334
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
306
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
335
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
307
336
|
template.annotation = { description: "Test" };
|
|
308
337
|
let expectations = function (result) {
|
|
309
338
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -314,9 +343,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
314
343
|
return validate(expectations, template, templatePrevious);
|
|
315
344
|
});
|
|
316
345
|
it("warn: changed 'value'", function () {
|
|
317
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
346
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodUIBorder.templateSchema));
|
|
318
347
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
319
|
-
template.typeid = "Adsk.Core:UI.Border-" +
|
|
348
|
+
template.typeid = "Adsk.Core:UI.Border-" + semver_1.default.inc("1.0.0", "patch");
|
|
320
349
|
template.properties[0].properties[0].value = 123456;
|
|
321
350
|
let expectations = function (result) {
|
|
322
351
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -328,9 +357,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
328
357
|
return validate(expectations, template, templatePrevious);
|
|
329
358
|
});
|
|
330
359
|
it("warn: changed 'id' (delete, add)", function () {
|
|
331
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
360
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
332
361
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
333
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
362
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
334
363
|
template.properties[0].properties[0].id = "xx";
|
|
335
364
|
let expectations = function (result) {
|
|
336
365
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -342,9 +371,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
342
371
|
return validate(expectations, template, templatePrevious);
|
|
343
372
|
});
|
|
344
373
|
it("warn: changed 'inherits'", function () {
|
|
345
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
374
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodReservedTypes.templateSchema));
|
|
346
375
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
347
|
-
template.typeid = "TeamLeoValidation2:Example-" +
|
|
376
|
+
template.typeid = "TeamLeoValidation2:Example-" + semver_1.default.inc("1.0.0", "patch");
|
|
348
377
|
template.inherits = "Reference<Adsk.Core:Math.Color-1.0.0>";
|
|
349
378
|
let expectations = function (result) {
|
|
350
379
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -356,10 +385,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
356
385
|
return validate(expectations, template, templatePrevious);
|
|
357
386
|
});
|
|
358
387
|
it("warn: added property", function () {
|
|
359
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
388
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
360
389
|
templatePrevious.annotation = { description: "Test" };
|
|
361
390
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
362
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
391
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
363
392
|
template.properties[0].properties.push({ id: "newPropId", typeid: "Float32" });
|
|
364
393
|
let expectations = function (result) {
|
|
365
394
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -371,10 +400,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
371
400
|
return validate(expectations, template, templatePrevious);
|
|
372
401
|
});
|
|
373
402
|
it("warn: deleted property", function () {
|
|
374
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
403
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
375
404
|
templatePrevious.annotation = { description: "Test" };
|
|
376
405
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
377
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
406
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "patch");
|
|
378
407
|
template.properties[0].properties.pop();
|
|
379
408
|
let expectations = function (result) {
|
|
380
409
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -388,9 +417,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
388
417
|
});
|
|
389
418
|
describe("incremented minor level", function () {
|
|
390
419
|
it("pass: same content", function () {
|
|
391
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
420
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
392
421
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
393
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
422
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
394
423
|
let expectations = function (result) {
|
|
395
424
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
396
425
|
(0, chai_1.expect)(result.errors).to.be.empty;
|
|
@@ -400,10 +429,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
400
429
|
return validate(expectations, template, templatePrevious);
|
|
401
430
|
});
|
|
402
431
|
it("pass: changed 'annotation'", function () {
|
|
403
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
432
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
404
433
|
templatePrevious.annotation = { description: "Test" };
|
|
405
434
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
406
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
435
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
407
436
|
template.annotation.description = "Changed!";
|
|
408
437
|
let expectations = function (result) {
|
|
409
438
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -414,10 +443,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
414
443
|
return validate(expectations, template, templatePrevious);
|
|
415
444
|
});
|
|
416
445
|
it("pass: deleted 'annotation'", function () {
|
|
417
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
446
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
418
447
|
templatePrevious.annotation = { description: "Test" };
|
|
419
448
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
420
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
449
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
421
450
|
delete template.annotation;
|
|
422
451
|
let expectations = function (result) {
|
|
423
452
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -428,9 +457,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
428
457
|
return validate(expectations, template, templatePrevious);
|
|
429
458
|
});
|
|
430
459
|
it("pass: added 'annotation'", function () {
|
|
431
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
460
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
432
461
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
433
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
462
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
434
463
|
template.annotation = { description: "Test" };
|
|
435
464
|
let expectations = function (result) {
|
|
436
465
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -441,9 +470,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
441
470
|
return validate(expectations, template, templatePrevious);
|
|
442
471
|
});
|
|
443
472
|
it("pass: changed 'value'", function () {
|
|
444
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
473
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodUIBorder.templateSchema));
|
|
445
474
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
446
|
-
template.typeid = "Adsk.Core:UI.Border-" +
|
|
475
|
+
template.typeid = "Adsk.Core:UI.Border-" + semver_1.default.inc("1.0.0", "minor");
|
|
447
476
|
template.properties[0].properties[0].value = 123456;
|
|
448
477
|
let expectations = function (result) {
|
|
449
478
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -454,9 +483,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
454
483
|
return validate(expectations, template, templatePrevious);
|
|
455
484
|
});
|
|
456
485
|
it("warn: changed 'id' (delete, add)", function () {
|
|
457
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
486
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
458
487
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
459
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
488
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
460
489
|
template.properties[0].properties[0].id = "xx";
|
|
461
490
|
let expectations = function (result) {
|
|
462
491
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -468,9 +497,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
468
497
|
return validate(expectations, template, templatePrevious);
|
|
469
498
|
});
|
|
470
499
|
it("warn: changed 'inherits'", function () {
|
|
471
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
500
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodReservedTypes.templateSchema));
|
|
472
501
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
473
|
-
template.typeid = "TeamLeoValidation2:Example-" +
|
|
502
|
+
template.typeid = "TeamLeoValidation2:Example-" + semver_1.default.inc("1.0.0", "minor");
|
|
474
503
|
template.inherits = "Reference<Adsk.Core:Math.Color-1.0.0>";
|
|
475
504
|
let expectations = function (result) {
|
|
476
505
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -482,10 +511,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
482
511
|
return validate(expectations, template, templatePrevious);
|
|
483
512
|
});
|
|
484
513
|
it("pass: added property", function () {
|
|
485
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
514
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
486
515
|
templatePrevious.annotation = { description: "Test" };
|
|
487
516
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
488
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
517
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
489
518
|
template.properties[0].properties.push({ id: "newPropId", typeid: "Float32" });
|
|
490
519
|
let expectations = function (result) {
|
|
491
520
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -496,10 +525,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
496
525
|
return validate(expectations, template, templatePrevious);
|
|
497
526
|
});
|
|
498
527
|
it("warn: deleted property", function () {
|
|
499
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
528
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
500
529
|
templatePrevious.annotation = { description: "Test" };
|
|
501
530
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
502
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
531
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "minor");
|
|
503
532
|
template.properties[0].properties.pop();
|
|
504
533
|
let expectations = function (result) {
|
|
505
534
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -513,9 +542,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
513
542
|
});
|
|
514
543
|
describe("incremented major level", function () {
|
|
515
544
|
it("pass: same content", function () {
|
|
516
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
545
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
517
546
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
518
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
547
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
519
548
|
let expectations = function (result) {
|
|
520
549
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
521
550
|
(0, chai_1.expect)(result.errors).to.be.empty;
|
|
@@ -525,10 +554,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
525
554
|
return validate(expectations, template, templatePrevious);
|
|
526
555
|
});
|
|
527
556
|
it("pass: changed 'annotation'", function () {
|
|
528
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
557
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
529
558
|
templatePrevious.annotation = { description: "Test" };
|
|
530
559
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
531
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
560
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
532
561
|
template.annotation.description = "Changed!";
|
|
533
562
|
let expectations = function (result) {
|
|
534
563
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -539,10 +568,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
539
568
|
return validate(expectations, template, templatePrevious);
|
|
540
569
|
});
|
|
541
570
|
it("pass: deleted 'annotation'", function () {
|
|
542
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
571
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
543
572
|
templatePrevious.annotation = { description: "Test" };
|
|
544
573
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
545
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
574
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
546
575
|
delete template.annotation;
|
|
547
576
|
let expectations = function (result) {
|
|
548
577
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -553,9 +582,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
553
582
|
return validate(expectations, template, templatePrevious);
|
|
554
583
|
});
|
|
555
584
|
it("pass: added 'annotation'", function () {
|
|
556
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
585
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
557
586
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
558
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
587
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
559
588
|
template.annotation = { description: "Test" };
|
|
560
589
|
let expectations = function (result) {
|
|
561
590
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -566,9 +595,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
566
595
|
return validate(expectations, template, templatePrevious);
|
|
567
596
|
});
|
|
568
597
|
it("pass: changed 'value'", function () {
|
|
569
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
598
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodUIBorder.templateSchema));
|
|
570
599
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
571
|
-
template.typeid = "Adsk.Core:UI.Border-" +
|
|
600
|
+
template.typeid = "Adsk.Core:UI.Border-" + semver_1.default.inc("1.0.0", "major");
|
|
572
601
|
template.properties[0].properties[0].value = 123456;
|
|
573
602
|
let expectations = function (result) {
|
|
574
603
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -579,9 +608,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
579
608
|
return validate(expectations, template, templatePrevious);
|
|
580
609
|
});
|
|
581
610
|
it("pass: changed 'id' (delete, add)", function () {
|
|
582
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
611
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
583
612
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
584
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
613
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
585
614
|
template.properties[0].properties[0].id = "xx";
|
|
586
615
|
let expectations = function (result) {
|
|
587
616
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -592,9 +621,9 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
592
621
|
return validate(expectations, template, templatePrevious);
|
|
593
622
|
});
|
|
594
623
|
it("pass: changed 'inherits'", function () {
|
|
595
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
624
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodReservedTypes.templateSchema));
|
|
596
625
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
597
|
-
template.typeid = "TeamLeoValidation2:Example-" +
|
|
626
|
+
template.typeid = "TeamLeoValidation2:Example-" + semver_1.default.inc("1.0.0", "major");
|
|
598
627
|
template.inherits = "Reference<Adsk.Core:Math.Color-1.0.0>";
|
|
599
628
|
let expectations = function (result) {
|
|
600
629
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -605,10 +634,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
605
634
|
return validate(expectations, template, templatePrevious);
|
|
606
635
|
});
|
|
607
636
|
it("pass: added property", function () {
|
|
608
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
637
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
609
638
|
templatePrevious.annotation = { description: "Test" };
|
|
610
639
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
611
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
640
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
612
641
|
template.properties[0].properties.push({ id: "newPropId", typeid: "Float32" });
|
|
613
642
|
let expectations = function (result) {
|
|
614
643
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -619,10 +648,10 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
619
648
|
return validate(expectations, template, templatePrevious);
|
|
620
649
|
});
|
|
621
650
|
it("pass: deleted property", function () {
|
|
622
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
651
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
623
652
|
templatePrevious.annotation = { description: "Test" };
|
|
624
653
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
625
|
-
template.typeid = "TeamLeoValidation2:PointID-" +
|
|
654
|
+
template.typeid = "TeamLeoValidation2:PointID-" + semver_1.default.inc("1.0.0", "major");
|
|
626
655
|
template.properties[0].properties.pop();
|
|
627
656
|
let expectations = function (result) {
|
|
628
657
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -636,7 +665,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
636
665
|
});
|
|
637
666
|
describe("skip semver validation", function () {
|
|
638
667
|
it("pass: deep equal on scrambled arrays", function () {
|
|
639
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
668
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
640
669
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
641
670
|
let tmp = template.properties[0].properties[0];
|
|
642
671
|
template.properties[0].properties[0] = template.properties[0].properties[2];
|
|
@@ -654,7 +683,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
654
683
|
return validate(expectations, template, templatePrevious, true);
|
|
655
684
|
});
|
|
656
685
|
it("pass: deep equal with version regression", function () {
|
|
657
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
686
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
658
687
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
659
688
|
let expectations = function (result) {
|
|
660
689
|
(0, chai_1.expect)(result).property("isValid", true);
|
|
@@ -665,7 +694,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
665
694
|
return validate(expectations, template, templatePrevious, true);
|
|
666
695
|
});
|
|
667
696
|
it("pass: preserves input templates", function () {
|
|
668
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
697
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodPointId.templateSchema));
|
|
669
698
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
670
699
|
let copies = [
|
|
671
700
|
JSON.parse(JSON.stringify(templatePrevious)),
|
|
@@ -682,7 +711,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
682
711
|
return validate(expectations, template, templatePrevious);
|
|
683
712
|
});
|
|
684
713
|
it("fail: changed value", function () {
|
|
685
|
-
let templatePrevious = JSON.parse(JSON.stringify(
|
|
714
|
+
let templatePrevious = JSON.parse(JSON.stringify(index_js_1.goodUIBorder.templateSchema));
|
|
686
715
|
let template = JSON.parse(JSON.stringify(templatePrevious));
|
|
687
716
|
template.properties[0].properties[0].value = 123456;
|
|
688
717
|
let expectations = function (result) {
|
|
@@ -697,7 +726,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
697
726
|
});
|
|
698
727
|
describe("syntax validation", function () {
|
|
699
728
|
it("pass: validate a simple file", function () {
|
|
700
|
-
let template =
|
|
729
|
+
let template = index_js_1.goodPointId.templateSchema;
|
|
701
730
|
let expectations = function (result) {
|
|
702
731
|
(0, chai_1.expect)(result.isValid).to.equal(true);
|
|
703
732
|
return result;
|
|
@@ -705,7 +734,7 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
705
734
|
return validate(expectations, template, null, true);
|
|
706
735
|
});
|
|
707
736
|
it("fail: invalid file", function () {
|
|
708
|
-
let template =
|
|
737
|
+
let template = index_js_1.badPrimitiveTypeid.templateSchema;
|
|
709
738
|
let expectations = function (result) {
|
|
710
739
|
(0, chai_1.expect)(result.isValid).to.equal(false);
|
|
711
740
|
(0, chai_1.expect)(result.errors.length).to.be.greaterThan(0);
|
|
@@ -787,8 +816,8 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
787
816
|
});
|
|
788
817
|
describe("Constants", function () {
|
|
789
818
|
before(function () {
|
|
790
|
-
let schemaValidator = new
|
|
791
|
-
new
|
|
819
|
+
let schemaValidator = new schemaValidator_js_1.SchemaValidator();
|
|
820
|
+
new templateValidator_js_1.TemplateValidator({
|
|
792
821
|
skipSemver: true,
|
|
793
822
|
inheritsFrom: schemaValidator.inheritsFrom,
|
|
794
823
|
hasSchema: schemaValidator.hasSchema,
|
|
@@ -960,8 +989,8 @@ const templateValidator_1 = require("../../templateValidator");
|
|
|
960
989
|
});
|
|
961
990
|
describe("Async validation", function () {
|
|
962
991
|
it("can perform context validation asynchronously", function (done) {
|
|
963
|
-
let schemaValidator = new
|
|
964
|
-
let templateValidator = new
|
|
992
|
+
let schemaValidator = new schemaValidator_js_1.SchemaValidator();
|
|
993
|
+
let templateValidator = new templateValidator_js_1.TemplateValidator({
|
|
965
994
|
inheritsFromAsync: schemaValidator.inheritsFromAsync,
|
|
966
995
|
hasSchemaAsync: schemaValidator.hasSchemaAsync,
|
|
967
996
|
});
|