@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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/README.md +1 -0
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +5 -5
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +70 -53
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +152 -103
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +4 -4
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +69 -47
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +3 -3
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +8 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -26
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +14 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +17 -17
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +4 -4
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +23 -23
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +47 -37
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +10 -10
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +21 -17
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +7 -5
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +5 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +9 -9
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +31 -25
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +18 -18
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +33 -29
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +31 -29
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +56 -40
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +5 -5
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +30 -29
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +31 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +11 -9
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +309 -252
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +17 -17
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +64 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +40 -25
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +566 -490
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +293 -280
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +100 -94
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +174 -147
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +67 -63
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +115 -97
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +5 -5
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +185 -166
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +109 -109
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +75 -76
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +571 -531
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +31 -31
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +805 -795
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +729 -679
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +16 -16
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +288 -227
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +326 -318
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +46 -36
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +259 -246
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +49 -43
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +2038 -1631
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +72 -102
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +22 -21
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +857 -703
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js +5 -5
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1334 -1144
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +12 -12
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +91 -91
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +4 -4
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +20 -20
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +5 -5
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +70 -53
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +152 -103
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +4 -4
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +73 -51
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.d.ts.map +1 -1
- package/lib/properties/boolProperty.js +3 -3
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +8 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -26
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +14 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +17 -17
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +4 -4
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.d.ts +23 -23
- package/lib/properties/index.d.ts.map +1 -1
- package/lib/properties/index.js +23 -23
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +47 -37
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +10 -10
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +21 -17
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts.map +1 -1
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +7 -5
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.d.ts.map +1 -1
- package/lib/properties/nodeProperty.js +5 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +9 -9
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +31 -25
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +18 -18
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +33 -29
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +31 -29
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +56 -40
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +5 -5
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +1 -1
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +30 -29
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +31 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +11 -9
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +309 -252
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +17 -17
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +64 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +40 -25
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +28 -28
- package/src/index.d.ts +2750 -2681
|
@@ -5,26 +5,24 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @fileoverview In this file, we will test the Int64ArrayProperty object described in /src/properties/arrayProperty.js
|
|
7
7
|
*/
|
|
8
|
-
describe(
|
|
8
|
+
describe("Int64ArrayProperty", function () {
|
|
9
9
|
var PropertyFactory, BaseProperty, ChangeSet, MSG;
|
|
10
10
|
var changeSetWithEntries, removalChangeSet;
|
|
11
11
|
var myInt64Prop, Int64;
|
|
12
12
|
before(function () {
|
|
13
13
|
// Get all the objects we need in this test here.
|
|
14
|
-
PropertyFactory = require(
|
|
15
|
-
BaseProperty = require(
|
|
16
|
-
ChangeSet = require(
|
|
17
|
-
Int64 = require(
|
|
18
|
-
MSG = require(
|
|
14
|
+
PropertyFactory = require("../..").PropertyFactory;
|
|
15
|
+
BaseProperty = require("../..").BaseProperty;
|
|
16
|
+
ChangeSet = require("@fluid-experimental/property-changeset").ChangeSet;
|
|
17
|
+
Int64 = require("@fluid-experimental/property-common").Int64;
|
|
18
|
+
MSG = require("@fluid-experimental/property-common").constants.MSG;
|
|
19
19
|
// Register a template with a set property for the tests
|
|
20
20
|
var SimpleInt64TestPropertyTemplate = {
|
|
21
|
-
typeid:
|
|
22
|
-
properties: [
|
|
23
|
-
{ id: 'int64Property', typeid: 'Int64', context: 'array' },
|
|
24
|
-
],
|
|
21
|
+
typeid: "autodesk.tests:SimpleInt64TestProperty-1.0.0",
|
|
22
|
+
properties: [{ id: "int64Property", typeid: "Int64", context: "array" }],
|
|
25
23
|
};
|
|
26
24
|
PropertyFactory._reregister(SimpleInt64TestPropertyTemplate);
|
|
27
|
-
myInt64Prop = PropertyFactory.create(
|
|
25
|
+
myInt64Prop = PropertyFactory.create("Int64", "array");
|
|
28
26
|
});
|
|
29
27
|
// Inserts an Int64 value into the array
|
|
30
28
|
var insertInt64Value = function (int64Prop) {
|
|
@@ -38,91 +36,148 @@ describe('Int64ArrayProperty', function () {
|
|
|
38
36
|
var modifyInt64Value = function (int64Prop) {
|
|
39
37
|
int64Prop.setRange(0, [new Int64(0, 2)]);
|
|
40
38
|
};
|
|
41
|
-
describe(
|
|
42
|
-
it(
|
|
39
|
+
describe("Testing creation, assignment and serialization", function () {
|
|
40
|
+
it("should be empty at the beginning", function () {
|
|
43
41
|
expect(myInt64Prop.length).to.equal(0);
|
|
44
|
-
expect(myInt64Prop.serialize({
|
|
45
|
-
expect(myInt64Prop.serialize({
|
|
42
|
+
expect(myInt64Prop.serialize({ dirtyOnly: true })).to.be.empty;
|
|
43
|
+
expect(myInt64Prop.serialize({ dirtyOnly: false })).to.be.empty;
|
|
46
44
|
});
|
|
47
|
-
it(
|
|
45
|
+
it("should be possible to insert into the 64 bit array", function () {
|
|
48
46
|
// Text insertion
|
|
49
|
-
myInt64Prop.insertRange(0, [new Int64(1, 2),
|
|
47
|
+
myInt64Prop.insertRange(0, [new Int64(1, 2), "12345678987654321"]);
|
|
50
48
|
expect(myInt64Prop.get(0)).to.deep.equal(new Int64(1, 2));
|
|
51
49
|
myInt64Prop.insertRange(2, [5]);
|
|
52
50
|
expect(myInt64Prop.get(1)).to.deep.equal(new Int64(1653732529, 2874452));
|
|
53
|
-
changeSetWithEntries = myInt64Prop.serialize({
|
|
54
|
-
expect(myInt64Prop.serialize({
|
|
55
|
-
|
|
51
|
+
changeSetWithEntries = myInt64Prop.serialize({ dirtyOnly: true });
|
|
52
|
+
expect(myInt64Prop.serialize({ dirtyOnly: false })).to.deep.equal({
|
|
53
|
+
insert: [
|
|
54
|
+
[
|
|
55
|
+
0,
|
|
56
|
+
[
|
|
57
|
+
[1, 2],
|
|
58
|
+
[1653732529, 2874452],
|
|
59
|
+
[5, 0],
|
|
60
|
+
],
|
|
61
|
+
],
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
expect(myInt64Prop.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
65
|
+
insert: [
|
|
66
|
+
[
|
|
67
|
+
0,
|
|
68
|
+
[
|
|
69
|
+
[1, 2],
|
|
70
|
+
[1653732529, 2874452],
|
|
71
|
+
[5, 0],
|
|
72
|
+
],
|
|
73
|
+
],
|
|
74
|
+
],
|
|
75
|
+
});
|
|
56
76
|
});
|
|
57
|
-
it(
|
|
58
|
-
myInt64Prop.setRange(0, [1,
|
|
77
|
+
it("should be possible to set values in the 64 bit array", function () {
|
|
78
|
+
myInt64Prop.setRange(0, [1, "123", new Int64(2, 2)]);
|
|
59
79
|
expect(myInt64Prop.get(0)).to.deep.equal(new Int64(1, 0));
|
|
60
80
|
myInt64Prop.setRange(2, [new Int64(4, 5)]);
|
|
61
|
-
changeSetWithEntries = myInt64Prop.serialize({
|
|
62
|
-
expect(myInt64Prop.serialize({
|
|
63
|
-
|
|
81
|
+
changeSetWithEntries = myInt64Prop.serialize({ dirtyOnly: true });
|
|
82
|
+
expect(myInt64Prop.serialize({ dirtyOnly: false })).to.deep.equal({
|
|
83
|
+
insert: [
|
|
84
|
+
[
|
|
85
|
+
0,
|
|
86
|
+
[
|
|
87
|
+
[1, 0],
|
|
88
|
+
[123, 0],
|
|
89
|
+
[4, 5],
|
|
90
|
+
],
|
|
91
|
+
],
|
|
92
|
+
],
|
|
93
|
+
});
|
|
94
|
+
expect(myInt64Prop.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
95
|
+
insert: [
|
|
96
|
+
[
|
|
97
|
+
0,
|
|
98
|
+
[
|
|
99
|
+
[1, 0],
|
|
100
|
+
[123, 0],
|
|
101
|
+
[4, 5],
|
|
102
|
+
],
|
|
103
|
+
],
|
|
104
|
+
],
|
|
105
|
+
});
|
|
64
106
|
});
|
|
65
|
-
it(
|
|
66
|
-
expect(() => {
|
|
67
|
-
.
|
|
107
|
+
it(".setRange should throw an error when in_offset is not an integer", function () {
|
|
108
|
+
expect(() => {
|
|
109
|
+
myInt64Prop.setRange("test", [new Int64(2, 2)]);
|
|
110
|
+
}).to.throw(MSG.NOT_NUMBER);
|
|
68
111
|
});
|
|
69
|
-
it(
|
|
70
|
-
expect(() => {
|
|
71
|
-
.
|
|
112
|
+
it(".setRange should throw an error when in_array is not an array", function () {
|
|
113
|
+
expect(() => {
|
|
114
|
+
myInt64Prop.setRange(0, new Int64(2, 2));
|
|
115
|
+
}).to.throw(MSG.IN_ARRAY_NOT_ARRAY + "Int64ArrayProperty.setRange");
|
|
72
116
|
});
|
|
73
|
-
it(
|
|
117
|
+
it("Should handle removals correctly", function () {
|
|
74
118
|
myInt64Prop.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
|
|
75
119
|
myInt64Prop.removeRange(0, 2);
|
|
76
120
|
expect(myInt64Prop.get(0)).to.deep.equal(new Int64(4, 5));
|
|
77
121
|
removalChangeSet = myInt64Prop.serialize({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
122
|
+
dirtyOnly: true,
|
|
123
|
+
includeRootTypeid: false,
|
|
124
|
+
dirtinessType: BaseProperty.MODIFIED_STATE_FLAGS.DIRTY,
|
|
81
125
|
});
|
|
82
|
-
expect(removalChangeSet).to.have.all.keys([
|
|
126
|
+
expect(removalChangeSet).to.have.all.keys(["remove"]);
|
|
83
127
|
expect(removalChangeSet.remove).to.have.length(1);
|
|
84
128
|
expect(removalChangeSet.remove[0]).to.deep.equal([0, 2]);
|
|
85
129
|
});
|
|
86
|
-
it(
|
|
87
|
-
var deserializedNode = PropertyFactory.create(
|
|
130
|
+
it("Should support deserialization", function () {
|
|
131
|
+
var deserializedNode = PropertyFactory.create("Int64", "array");
|
|
88
132
|
var deserializedChanges1 = deserializedNode.deserialize(changeSetWithEntries);
|
|
89
133
|
expect(deserializedChanges1).to.deep.equal(changeSetWithEntries);
|
|
90
134
|
var deserializedChanges3 = deserializedNode.deserialize({});
|
|
91
135
|
expect(deserializedChanges3).to.deep.equal({ remove: [[0, 3]] });
|
|
92
136
|
});
|
|
93
|
-
it(
|
|
137
|
+
it("inserting at a bad position should throw an exception", function () {
|
|
94
138
|
expect(function () {
|
|
95
139
|
myInt64Prop.insertRange(2242, new Int64(4, 5));
|
|
96
140
|
}).to.throw();
|
|
97
141
|
});
|
|
98
|
-
it(
|
|
99
|
-
var node = PropertyFactory.create(
|
|
142
|
+
it("Should support applying changeset", function () {
|
|
143
|
+
var node = PropertyFactory.create("Int64", "array");
|
|
100
144
|
node._applyChangeset(changeSetWithEntries);
|
|
101
145
|
expect(node.get(0)).to.deep.equal(new Int64(1));
|
|
102
|
-
expect(node.serialize()).to.deep.equal({
|
|
146
|
+
expect(node.serialize()).to.deep.equal({
|
|
147
|
+
insert: [
|
|
148
|
+
[
|
|
149
|
+
0,
|
|
150
|
+
[
|
|
151
|
+
[1, 0],
|
|
152
|
+
[123, 0],
|
|
153
|
+
[4, 5],
|
|
154
|
+
],
|
|
155
|
+
],
|
|
156
|
+
],
|
|
157
|
+
});
|
|
103
158
|
});
|
|
104
159
|
});
|
|
105
|
-
describe(
|
|
106
|
-
it(
|
|
107
|
-
var t = PropertyFactory.create(
|
|
160
|
+
describe("change set specification should be met", function () {
|
|
161
|
+
it("Should handle push correctly", function () {
|
|
162
|
+
var t = PropertyFactory.create("Int64", "array");
|
|
108
163
|
t.insertRange(0, [new Int64(1, 2), new Int64(3, 4)]);
|
|
109
164
|
t.cleanDirty();
|
|
110
165
|
t.push(new Int64(4, 5));
|
|
111
|
-
expect(t.serialize({
|
|
112
|
-
|
|
166
|
+
expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
167
|
+
insert: [[2, [[4, 5]]]],
|
|
113
168
|
});
|
|
114
169
|
});
|
|
115
|
-
it(
|
|
116
|
-
var t = PropertyFactory.create(
|
|
170
|
+
it("Should handle modifies correctly", function () {
|
|
171
|
+
var t = PropertyFactory.create("Int64", "array");
|
|
117
172
|
t.insertRange(0, [new Int64(1, 2), new Int64(3, 4)]);
|
|
118
173
|
t.cleanDirty();
|
|
119
174
|
t.set(1, new Int64(4, 5));
|
|
120
|
-
expect(t.serialize({
|
|
121
|
-
|
|
175
|
+
expect(t.serialize({ dirtyOnly: true })).to.deep.equal({
|
|
176
|
+
modify: [[1, [[4, 5]]]],
|
|
122
177
|
});
|
|
123
178
|
});
|
|
124
179
|
});
|
|
125
|
-
describe(
|
|
180
|
+
describe("squashing", function () {
|
|
126
181
|
// Helper function to test the squashing for different containers
|
|
127
182
|
var innerTestChangeSetSquashing = function (io_testProperty, io_int64Property, io_initialChangeset, in_options, in_collection) {
|
|
128
183
|
var squashedChangeset = new ChangeSet();
|
|
@@ -132,7 +187,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
132
187
|
var callbacks = in_options.callbacks;
|
|
133
188
|
for (var i = 0; i < callbacks.length; i++) {
|
|
134
189
|
callbacks[i](io_int64Property);
|
|
135
|
-
var changes = io_testProperty.serialize({
|
|
190
|
+
var changes = io_testProperty.serialize({ dirtyOnly: true });
|
|
136
191
|
io_testProperty.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
137
192
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
138
193
|
squashedChangeset.applyChangeSet(changes);
|
|
@@ -155,40 +210,47 @@ describe('Int64ArrayProperty', function () {
|
|
|
155
210
|
// be given as first parameter
|
|
156
211
|
//
|
|
157
212
|
var testChangeSetSquashing = function (in_options) {
|
|
158
|
-
var testProperty = PropertyFactory.create(
|
|
213
|
+
var testProperty = PropertyFactory.create("autodesk.tests:SimpleInt64TestProperty-1.0.0");
|
|
159
214
|
if (in_options.pre) {
|
|
160
215
|
in_options.pre(testProperty._properties.int64Property);
|
|
161
216
|
}
|
|
162
|
-
var initialChangeset = new ChangeSet(testProperty.serialize({
|
|
217
|
+
var initialChangeset = new ChangeSet(testProperty.serialize({ dirtyOnly: false }));
|
|
163
218
|
initialChangeset.setIsNormalized(true);
|
|
164
219
|
innerTestChangeSetSquashing(testProperty, testProperty._properties.int64Property, initialChangeset, in_options);
|
|
165
220
|
var initialChangeset = initialChangeset.getSerializedChangeSet();
|
|
166
221
|
if (ChangeSet.isEmptyChangeSet(initialChangeset)) {
|
|
167
222
|
// if one is empty the other should be empty, too
|
|
168
|
-
expect(testProperty.serialize({
|
|
223
|
+
expect(testProperty.serialize({ dirtyOnly: false })).to.be.empty;
|
|
169
224
|
}
|
|
170
225
|
else {
|
|
171
226
|
// else they must be deep equal
|
|
172
|
-
expect(initialChangeset[
|
|
227
|
+
expect(initialChangeset["array<Int64>"].int64Property).to.deep.equal(testProperty.serialize({ dirtyOnly: false })["array<Int64>"].int64Property);
|
|
173
228
|
}
|
|
174
229
|
};
|
|
175
|
-
it(
|
|
176
|
-
testChangeSetSquashing({
|
|
230
|
+
it("should work for multiple independent inserts", function () {
|
|
231
|
+
testChangeSetSquashing({
|
|
232
|
+
callbacks: [insertInt64Value, insertInt64Value, insertInt64Value],
|
|
233
|
+
});
|
|
177
234
|
});
|
|
178
|
-
it(
|
|
235
|
+
it("should work for inserts followed by removes", function () {
|
|
179
236
|
testChangeSetSquashing({
|
|
180
|
-
callbacks: [
|
|
237
|
+
callbacks: [
|
|
238
|
+
insertInt64Value,
|
|
239
|
+
insertInt64Value,
|
|
240
|
+
removeArrayElement,
|
|
241
|
+
removeArrayElement,
|
|
242
|
+
],
|
|
181
243
|
post: function (changeset) {
|
|
182
244
|
expect(changeset).to.be.empty;
|
|
183
245
|
},
|
|
184
246
|
});
|
|
185
247
|
});
|
|
186
|
-
it(
|
|
248
|
+
it("should work for mixed modifies and inserts", function () {
|
|
187
249
|
testChangeSetSquashing({
|
|
188
250
|
callbacks: [insertInt64Value, modifyInt64Value, insertInt64Value, modifyInt64Value],
|
|
189
251
|
});
|
|
190
252
|
});
|
|
191
|
-
it(
|
|
253
|
+
it("an insert, modify and a remove should give an empty changeset", function () {
|
|
192
254
|
testChangeSetSquashing({
|
|
193
255
|
callbacks: [insertInt64Value, modifyInt64Value, removeArrayElement],
|
|
194
256
|
post: function (changeset) {
|
|
@@ -196,25 +258,25 @@ describe('Int64ArrayProperty', function () {
|
|
|
196
258
|
},
|
|
197
259
|
});
|
|
198
260
|
});
|
|
199
|
-
it(
|
|
261
|
+
it("work for modifies after an already existing insert", function () {
|
|
200
262
|
testChangeSetSquashing({
|
|
201
263
|
pre: insertInt64Value,
|
|
202
264
|
callbacks: [modifyInt64Value, modifyInt64Value],
|
|
203
265
|
});
|
|
204
266
|
});
|
|
205
|
-
it(
|
|
267
|
+
it("of modify and remove after an already existing insert should work", function () {
|
|
206
268
|
testChangeSetSquashing({
|
|
207
269
|
pre: insertInt64Value,
|
|
208
270
|
callbacks: [modifyInt64Value, removeArrayElement],
|
|
209
271
|
post: function (changeset) {
|
|
210
|
-
expect(changeset[
|
|
272
|
+
expect(changeset["array<Int64>"].int64Property).to.have.all.keys("remove");
|
|
211
273
|
},
|
|
212
274
|
});
|
|
213
275
|
});
|
|
214
276
|
});
|
|
215
|
-
describe(
|
|
277
|
+
describe("Rebasing", function () {
|
|
216
278
|
var createPropertyForRebaseTestByTemplate = function () {
|
|
217
|
-
return PropertyFactory.create(
|
|
279
|
+
return PropertyFactory.create("autodesk.tests:SimpleInt64TestProperty-1.0.0");
|
|
218
280
|
};
|
|
219
281
|
var getint64PropertyFromNode = function (in_testProperty) {
|
|
220
282
|
return in_testProperty._properties.int64Property;
|
|
@@ -227,9 +289,9 @@ describe('Int64ArrayProperty', function () {
|
|
|
227
289
|
}
|
|
228
290
|
// Create two copies of this state
|
|
229
291
|
var baseProperty2 = in_creator();
|
|
230
|
-
baseProperty2.deserialize(baseProperty1.serialize({
|
|
292
|
+
baseProperty2.deserialize(baseProperty1.serialize({ dirtyOnly: false }));
|
|
231
293
|
var baseProperty3 = in_creator();
|
|
232
|
-
baseProperty3.deserialize(baseProperty1.serialize({
|
|
294
|
+
baseProperty3.deserialize(baseProperty1.serialize({ dirtyOnly: false }));
|
|
233
295
|
// Make sure the states are clear
|
|
234
296
|
baseProperty1.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
235
297
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
@@ -237,7 +299,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
237
299
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
238
300
|
baseProperty3.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.DIRTY |
|
|
239
301
|
BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE);
|
|
240
|
-
var initialChangeSet = baseProperty1.serialize({
|
|
302
|
+
var initialChangeSet = baseProperty1.serialize({ dirtyOnly: false });
|
|
241
303
|
// Apply the operations to the two properties in parallel
|
|
242
304
|
if (in_options.op1) {
|
|
243
305
|
in_options.op1(in_getInnerProperty(baseProperty1));
|
|
@@ -246,8 +308,8 @@ describe('Int64ArrayProperty', function () {
|
|
|
246
308
|
in_options.op2(in_getInnerProperty(baseProperty2));
|
|
247
309
|
}
|
|
248
310
|
// Get the ChangeSets
|
|
249
|
-
var changeSet1 = new ChangeSet(baseProperty1.serialize({
|
|
250
|
-
var changeSet2 = baseProperty2.serialize({
|
|
311
|
+
var changeSet1 = new ChangeSet(baseProperty1.serialize({ dirtyOnly: true }));
|
|
312
|
+
var changeSet2 = baseProperty2.serialize({ dirtyOnly: true });
|
|
251
313
|
// Perform the actual rebase
|
|
252
314
|
var conflicts = [];
|
|
253
315
|
changeSet1._rebaseChangeSet(changeSet2, conflicts);
|
|
@@ -262,7 +324,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
262
324
|
if (in_options.op2) {
|
|
263
325
|
in_options.op2(in_getInnerProperty(baseProperty3));
|
|
264
326
|
}
|
|
265
|
-
var finalChangeSet = baseProperty3.serialize({
|
|
327
|
+
var finalChangeSet = baseProperty3.serialize({ dirtyOnly: false });
|
|
266
328
|
if (in_isCollection && finalChangeSet.insert) {
|
|
267
329
|
finalChangeSet = finalChangeSet.insert;
|
|
268
330
|
}
|
|
@@ -273,7 +335,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
273
335
|
}
|
|
274
336
|
else {
|
|
275
337
|
// else they must be deep equal
|
|
276
|
-
expect(combinedSerialized[
|
|
338
|
+
expect(combinedSerialized["array<Int64>"].int64Property).to.deep.equal(finalChangeSet["array<Int64>"].int64Property);
|
|
277
339
|
}
|
|
278
340
|
}
|
|
279
341
|
if (in_options.checkResult) {
|
|
@@ -286,20 +348,20 @@ describe('Int64ArrayProperty', function () {
|
|
|
286
348
|
var testRebasing = function (in_options) {
|
|
287
349
|
testRebasingInner(createPropertyForRebaseTestByTemplate, getint64PropertyFromNode, in_options);
|
|
288
350
|
};
|
|
289
|
-
it(
|
|
351
|
+
it("with a NOP should be possible", function () {
|
|
290
352
|
testRebasing({
|
|
291
353
|
op2: insertInt64Value,
|
|
292
354
|
compareToSequential: true,
|
|
293
355
|
});
|
|
294
356
|
});
|
|
295
|
-
it(
|
|
357
|
+
it("with independent inserts should be possible", function () {
|
|
296
358
|
testRebasing({
|
|
297
359
|
op1: insertInt64Value,
|
|
298
360
|
op2: insertInt64Value,
|
|
299
361
|
compareToSequential: true,
|
|
300
362
|
});
|
|
301
363
|
});
|
|
302
|
-
it(
|
|
364
|
+
it("with independent removes should be possible", function () {
|
|
303
365
|
testRebasing({
|
|
304
366
|
prepare: function (root) {
|
|
305
367
|
insertInt64Value(root);
|
|
@@ -314,7 +376,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
314
376
|
compareToSequential: true,
|
|
315
377
|
});
|
|
316
378
|
});
|
|
317
|
-
it(
|
|
379
|
+
it("with a modify and a remove should possible", function () {
|
|
318
380
|
testRebasing({
|
|
319
381
|
prepare: insertInt64Value,
|
|
320
382
|
op1: modifyInt64Value,
|
|
@@ -322,7 +384,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
322
384
|
compareToSequential: true,
|
|
323
385
|
});
|
|
324
386
|
});
|
|
325
|
-
it(
|
|
387
|
+
it("with a remove and a modify should possible", function () {
|
|
326
388
|
testRebasing({
|
|
327
389
|
prepare: insertInt64Value,
|
|
328
390
|
op1: removeArrayElement,
|
|
@@ -331,11 +393,11 @@ describe('Int64ArrayProperty', function () {
|
|
|
331
393
|
checkResult: function (conflicts, changeSet) {
|
|
332
394
|
expect(conflicts).to.have.length(1);
|
|
333
395
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
|
|
334
|
-
expect(conflicts[0].path).to.be.equal(
|
|
396
|
+
expect(conflicts[0].path).to.be.equal("int64Property");
|
|
335
397
|
},
|
|
336
398
|
});
|
|
337
399
|
});
|
|
338
|
-
it(
|
|
400
|
+
it("with two compatible removes should be possible", function () {
|
|
339
401
|
testRebasing({
|
|
340
402
|
prepare: insertInt64Value,
|
|
341
403
|
op1: removeArrayElement,
|
|
@@ -346,7 +408,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
346
408
|
},
|
|
347
409
|
});
|
|
348
410
|
});
|
|
349
|
-
it(
|
|
411
|
+
it("with two independent modifies should be possible", function () {
|
|
350
412
|
testRebasing({
|
|
351
413
|
prepare: function (root) {
|
|
352
414
|
root.insertRange(0, [new Int64(9, 8), new Int64(11, 21)]);
|
|
@@ -361,7 +423,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
361
423
|
},
|
|
362
424
|
});
|
|
363
425
|
});
|
|
364
|
-
it(
|
|
426
|
+
it("with two conflicting modifies should be possible and report a conflict", function () {
|
|
365
427
|
testRebasing({
|
|
366
428
|
prepare: insertInt64Value,
|
|
367
429
|
op1: function (int64Prop) {
|
|
@@ -371,13 +433,15 @@ describe('Int64ArrayProperty', function () {
|
|
|
371
433
|
compareToSequential: true,
|
|
372
434
|
checkResult: function (conflicts, changeSet) {
|
|
373
435
|
expect(conflicts).to.have.length(1);
|
|
374
|
-
expect(changeSet[
|
|
436
|
+
expect(changeSet["array<Int64>"].int64Property.modify[0][1]).to.deep.equal([
|
|
437
|
+
[0, 2],
|
|
438
|
+
]);
|
|
375
439
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.COLLIDING_SET);
|
|
376
|
-
expect(conflicts[0].path).to.be.equal(
|
|
440
|
+
expect(conflicts[0].path).to.be.equal("int64Property");
|
|
377
441
|
},
|
|
378
442
|
});
|
|
379
443
|
});
|
|
380
|
-
it(
|
|
444
|
+
it("with modify followed by remove+insert should work", function () {
|
|
381
445
|
testRebasing({
|
|
382
446
|
prepare: insertInt64Value,
|
|
383
447
|
op1: modifyInt64Value,
|
|
@@ -389,12 +453,12 @@ describe('Int64ArrayProperty', function () {
|
|
|
389
453
|
checkResult: function (conflicts, changeSet) {
|
|
390
454
|
expect(conflicts).to.have.length(1);
|
|
391
455
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.REMOVE_AFTER_MODIFY);
|
|
392
|
-
expect(conflicts[0].path).to.be.equal(
|
|
393
|
-
expect(changeSet[
|
|
456
|
+
expect(conflicts[0].path).to.be.equal("int64Property");
|
|
457
|
+
expect(changeSet["array<Int64>"].int64Property).to.have.all.keys("remove", "insert");
|
|
394
458
|
},
|
|
395
459
|
});
|
|
396
460
|
});
|
|
397
|
-
it(
|
|
461
|
+
it("with remove + insert followed by modify should report conflict", function () {
|
|
398
462
|
testRebasing({
|
|
399
463
|
prepare: insertInt64Value,
|
|
400
464
|
op1: function (root) {
|
|
@@ -406,11 +470,11 @@ describe('Int64ArrayProperty', function () {
|
|
|
406
470
|
checkResult: function (conflicts, changeSet) {
|
|
407
471
|
expect(conflicts).to.have.length(1);
|
|
408
472
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE);
|
|
409
|
-
expect(conflicts[0].path).to.be.equal(
|
|
473
|
+
expect(conflicts[0].path).to.be.equal("int64Property");
|
|
410
474
|
},
|
|
411
475
|
});
|
|
412
476
|
});
|
|
413
|
-
it(
|
|
477
|
+
it("with conflicting inserts should report conflict", function () {
|
|
414
478
|
testRebasing({
|
|
415
479
|
prepare: insertInt64Value,
|
|
416
480
|
op1: insertInt64Value,
|
|
@@ -419,7 +483,7 @@ describe('Int64ArrayProperty', function () {
|
|
|
419
483
|
checkResult: function (conflicts, changeSet) {
|
|
420
484
|
expect(conflicts).to.have.length(1);
|
|
421
485
|
expect(conflicts[0].type).to.be.equal(ChangeSet.ConflictType.INSERTED_ENTRY_WITH_SAME_KEY);
|
|
422
|
-
expect(conflicts[0].path).to.be.equal(
|
|
486
|
+
expect(conflicts[0].path).to.be.equal("int64Property");
|
|
423
487
|
},
|
|
424
488
|
});
|
|
425
489
|
});
|