@fluidframework/merge-tree 2.31.0 → 2.32.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/CHANGELOG.md +4 -0
- package/dist/client.d.ts +7 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +153 -44
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mergeTree.d.ts +17 -5
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +188 -79
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +16 -18
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +6 -0
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/perspective.d.ts +9 -0
- package/dist/perspective.d.ts.map +1 -1
- package/dist/perspective.js +14 -1
- package/dist/perspective.js.map +1 -1
- package/dist/segmentInfos.d.ts +32 -4
- package/dist/segmentInfos.d.ts.map +1 -1
- package/dist/segmentInfos.js +3 -1
- package/dist/segmentInfos.js.map +1 -1
- package/dist/sortedSegmentSet.d.ts +1 -0
- package/dist/sortedSegmentSet.d.ts.map +1 -1
- package/dist/sortedSegmentSet.js +3 -0
- package/dist/sortedSegmentSet.js.map +1 -1
- package/dist/test/beastTest.spec.js +5 -5
- package/dist/test/beastTest.spec.js.map +1 -1
- package/dist/test/client.localReference.spec.js +3 -3
- package/dist/test/client.localReference.spec.js.map +1 -1
- package/dist/test/client.rollback.spec.js +17 -0
- package/dist/test/client.rollback.spec.js.map +1 -1
- package/dist/test/clientTestHelper.d.ts +100 -0
- package/dist/test/clientTestHelper.d.ts.map +1 -0
- package/dist/test/clientTestHelper.js +196 -0
- package/dist/test/clientTestHelper.js.map +1 -0
- package/dist/test/mergeTree.annotate.spec.js +12 -12
- package/dist/test/mergeTree.annotate.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/dist/test/obliterate.concurrent.spec.js +93 -90
- package/dist/test/obliterate.concurrent.spec.js.map +1 -1
- package/dist/test/obliterate.deltaCallback.spec.js +121 -116
- package/dist/test/obliterate.deltaCallback.spec.js.map +1 -1
- package/dist/test/obliterate.rangeExpansion.spec.js +29 -79
- package/dist/test/obliterate.rangeExpansion.spec.js.map +1 -1
- package/dist/test/obliterate.reconnect.spec.js +235 -58
- package/dist/test/obliterate.reconnect.spec.js.map +1 -1
- package/dist/test/testClient.js +1 -1
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/testUtils.d.ts +13 -0
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +22 -1
- package/dist/test/testUtils.js.map +1 -1
- package/lib/client.d.ts +7 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +155 -46
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/mergeTree.d.ts +17 -5
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +192 -83
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts +16 -18
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js +7 -1
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/perspective.d.ts +9 -0
- package/lib/perspective.d.ts.map +1 -1
- package/lib/perspective.js +12 -0
- package/lib/perspective.js.map +1 -1
- package/lib/segmentInfos.d.ts +32 -4
- package/lib/segmentInfos.d.ts.map +1 -1
- package/lib/segmentInfos.js +2 -1
- package/lib/segmentInfos.js.map +1 -1
- package/lib/sortedSegmentSet.d.ts +1 -0
- package/lib/sortedSegmentSet.d.ts.map +1 -1
- package/lib/sortedSegmentSet.js +3 -0
- package/lib/sortedSegmentSet.js.map +1 -1
- package/lib/test/beastTest.spec.js +5 -5
- package/lib/test/beastTest.spec.js.map +1 -1
- package/lib/test/client.localReference.spec.js +3 -3
- package/lib/test/client.localReference.spec.js.map +1 -1
- package/lib/test/client.rollback.spec.js +18 -1
- package/lib/test/client.rollback.spec.js.map +1 -1
- package/lib/test/clientTestHelper.d.ts +100 -0
- package/lib/test/clientTestHelper.d.ts.map +1 -0
- package/lib/test/clientTestHelper.js +192 -0
- package/lib/test/clientTestHelper.js.map +1 -0
- package/lib/test/mergeTree.annotate.spec.js +12 -12
- package/lib/test/mergeTree.annotate.spec.js.map +1 -1
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/lib/test/obliterate.concurrent.spec.js +93 -90
- package/lib/test/obliterate.concurrent.spec.js.map +1 -1
- package/lib/test/obliterate.deltaCallback.spec.js +121 -116
- package/lib/test/obliterate.deltaCallback.spec.js.map +1 -1
- package/lib/test/obliterate.rangeExpansion.spec.js +1 -51
- package/lib/test/obliterate.rangeExpansion.spec.js.map +1 -1
- package/lib/test/obliterate.reconnect.spec.js +236 -59
- package/lib/test/obliterate.reconnect.spec.js.map +1 -1
- package/lib/test/testClient.js +1 -1
- package/lib/test/testClient.js.map +1 -1
- package/lib/test/testUtils.d.ts +13 -0
- package/lib/test/testUtils.d.ts.map +1 -1
- package/lib/test/testUtils.js +20 -0
- package/lib/test/testUtils.js.map +1 -1
- package/package.json +19 -18
- package/src/client.ts +286 -55
- package/src/index.ts +1 -1
- package/src/mergeTree.ts +265 -98
- package/src/mergeTreeNodes.ts +24 -18
- package/src/perspective.ts +21 -0
- package/src/segmentInfos.ts +48 -6
- package/src/sortedSegmentSet.ts +4 -0
- package/dist/test/partialSyncHelper.d.ts +0 -42
- package/dist/test/partialSyncHelper.d.ts.map +0 -1
- package/dist/test/partialSyncHelper.js +0 -96
- package/dist/test/partialSyncHelper.js.map +0 -1
- package/dist/test/reconnectHelper.d.ts +0 -50
- package/dist/test/reconnectHelper.d.ts.map +0 -1
- package/dist/test/reconnectHelper.js +0 -106
- package/dist/test/reconnectHelper.js.map +0 -1
- package/lib/test/partialSyncHelper.d.ts +0 -42
- package/lib/test/partialSyncHelper.d.ts.map +0 -1
- package/lib/test/partialSyncHelper.js +0 -92
- package/lib/test/partialSyncHelper.js.map +0 -1
- package/lib/test/reconnectHelper.d.ts +0 -50
- package/lib/test/reconnectHelper.d.ts.map +0 -1
- package/lib/test/reconnectHelper.js +0 -102
- package/lib/test/reconnectHelper.js.map +0 -1
|
@@ -6,140 +6,145 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const node_assert_1 = require("node:assert");
|
|
8
8
|
const ops_js_1 = require("../ops.js");
|
|
9
|
-
const
|
|
9
|
+
const clientTestHelper_js_1 = require("./clientTestHelper.js");
|
|
10
10
|
const testUtils_js_1 = require("./testUtils.js");
|
|
11
|
-
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
for (const mergeTreeEnableSidedObliterate of [true, false]) {
|
|
12
|
+
describe(`obliterate delta callback enableSidedObliterate = ${mergeTreeEnableSidedObliterate}`, () => {
|
|
13
|
+
(0, testUtils_js_1.useStrictPartialLengthChecks)();
|
|
14
|
+
let length;
|
|
15
|
+
let cb;
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
length = 0;
|
|
18
|
+
cb = (opArgs, deltaArgs) => {
|
|
19
|
+
switch (opArgs.op.type) {
|
|
20
|
+
case ops_js_1.MergeTreeDeltaType.INSERT: {
|
|
21
|
+
for (const { segment } of deltaArgs.deltaSegments) {
|
|
22
|
+
length += segment.cachedLength;
|
|
23
|
+
}
|
|
24
|
+
break;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
case ops_js_1.MergeTreeDeltaType.REMOVE:
|
|
27
|
+
case ops_js_1.MergeTreeDeltaType.OBLITERATE_SIDED:
|
|
28
|
+
case ops_js_1.MergeTreeDeltaType.OBLITERATE: {
|
|
29
|
+
for (const { segment } of deltaArgs.deltaSegments) {
|
|
30
|
+
length -= segment.cachedLength;
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
default:
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
describe("is invoked", () => {
|
|
37
|
-
it("on local obliterate", () => {
|
|
38
|
-
const helper = new reconnectHelper_js_1.ReconnectTestHelper();
|
|
39
|
-
let count = 0;
|
|
40
|
-
helper.clients.A.on("delta", (opArgs, deltaArgs) => {
|
|
41
|
-
if (opArgs.op.type === ops_js_1.MergeTreeDeltaType.OBLITERATE) {
|
|
42
|
-
count += 1;
|
|
34
|
+
default:
|
|
43
35
|
}
|
|
44
|
-
}
|
|
45
|
-
helper.insertText("A", 0, "a");
|
|
46
|
-
node_assert_1.strict.equal(count, 0);
|
|
47
|
-
helper.obliterateRange("A", 0, 1);
|
|
48
|
-
node_assert_1.strict.equal(count, 1);
|
|
49
|
-
helper.processAllOps();
|
|
50
|
-
node_assert_1.strict.equal(count, 1);
|
|
51
|
-
node_assert_1.strict.equal(helper.clients.A.getText(), "");
|
|
52
|
-
helper.logger.validate();
|
|
36
|
+
};
|
|
53
37
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
describe("is invoked", () => {
|
|
39
|
+
it("on local obliterate", () => {
|
|
40
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
41
|
+
let count = 0;
|
|
42
|
+
helper.clients.A.on("delta", (opArgs, deltaArgs) => {
|
|
43
|
+
if (opArgs.op.type === ops_js_1.MergeTreeDeltaType.OBLITERATE ||
|
|
44
|
+
opArgs.op.type === ops_js_1.MergeTreeDeltaType.OBLITERATE_SIDED) {
|
|
45
|
+
count += 1;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
helper.insertText("A", 0, "a");
|
|
49
|
+
node_assert_1.strict.equal(count, 0);
|
|
50
|
+
helper.obliterateRange("A", 0, 1);
|
|
51
|
+
node_assert_1.strict.equal(count, 1);
|
|
52
|
+
helper.processAllOps();
|
|
53
|
+
node_assert_1.strict.equal(count, 1);
|
|
54
|
+
node_assert_1.strict.equal(helper.clients.A.getText(), "");
|
|
55
|
+
helper.logger.validate();
|
|
56
|
+
});
|
|
57
|
+
it("on remote obliterate", () => {
|
|
58
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
59
|
+
let count = 0;
|
|
60
|
+
helper.clients.A.on("delta", (opArgs, deltaArgs) => {
|
|
61
|
+
if (opArgs.op.type === ops_js_1.MergeTreeDeltaType.OBLITERATE ||
|
|
62
|
+
opArgs.op.type === ops_js_1.MergeTreeDeltaType.OBLITERATE_SIDED) {
|
|
63
|
+
count += 1;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
helper.insertText("B", 0, "a");
|
|
67
|
+
node_assert_1.strict.equal(count, 0);
|
|
68
|
+
helper.obliterateRange("B", 0, 1);
|
|
69
|
+
node_assert_1.strict.equal(count, 0);
|
|
70
|
+
helper.processAllOps();
|
|
71
|
+
node_assert_1.strict.equal(count, 1);
|
|
72
|
+
node_assert_1.strict.equal(helper.clients.A.getText(), "");
|
|
73
|
+
helper.logger.validate();
|
|
61
74
|
});
|
|
62
|
-
helper.insertText("B", 0, "a");
|
|
63
|
-
node_assert_1.strict.equal(count, 0);
|
|
64
|
-
helper.obliterateRange("B", 0, 1);
|
|
65
|
-
node_assert_1.strict.equal(count, 0);
|
|
66
|
-
helper.processAllOps();
|
|
67
|
-
node_assert_1.strict.equal(count, 1);
|
|
68
|
-
node_assert_1.strict.equal(helper.clients.A.getText(), "");
|
|
69
|
-
helper.logger.validate();
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
describe("overlapping obliterate and remove", () => {
|
|
73
|
-
const text = "abcdef";
|
|
74
|
-
it("remove first", () => {
|
|
75
|
-
const helper = new reconnectHelper_js_1.ReconnectTestHelper();
|
|
76
|
-
helper.clients.A.on("delta", cb);
|
|
77
|
-
helper.insertText("A", 0, text);
|
|
78
|
-
helper.processAllOps();
|
|
79
|
-
node_assert_1.strict.equal(length, text.length);
|
|
80
|
-
helper.removeRange("B", 0, text.length);
|
|
81
|
-
helper.obliterateRange("C", 0, text.length);
|
|
82
|
-
helper.processAllOps();
|
|
83
|
-
node_assert_1.strict.equal(length, 0);
|
|
84
|
-
helper.logger.validate();
|
|
85
|
-
helper.clients.A.off("delta", cb);
|
|
86
75
|
});
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
76
|
+
describe("overlapping obliterate and remove", () => {
|
|
77
|
+
const text = "abcdef";
|
|
78
|
+
it("remove first", () => {
|
|
79
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
80
|
+
helper.clients.A.on("delta", cb);
|
|
81
|
+
helper.insertText("A", 0, text);
|
|
82
|
+
helper.processAllOps();
|
|
83
|
+
node_assert_1.strict.equal(length, text.length);
|
|
84
|
+
helper.removeRange("B", 0, text.length);
|
|
85
|
+
helper.obliterateRange("C", 0, text.length);
|
|
86
|
+
helper.processAllOps();
|
|
87
|
+
node_assert_1.strict.equal(length, 0);
|
|
88
|
+
helper.logger.validate();
|
|
89
|
+
helper.clients.A.off("delta", cb);
|
|
90
|
+
});
|
|
91
|
+
it("obliterate first", () => {
|
|
92
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
93
|
+
helper.clients.A.on("delta", cb);
|
|
94
|
+
helper.insertText("B", 0, text);
|
|
95
|
+
helper.processAllOps();
|
|
96
|
+
node_assert_1.strict.equal(length, text.length);
|
|
97
|
+
helper.obliterateRange("C", 0, text.length);
|
|
98
|
+
helper.removeRange("B", 0, text.length);
|
|
99
|
+
helper.processAllOps();
|
|
100
|
+
node_assert_1.strict.equal(length, 0);
|
|
101
|
+
helper.logger.validate();
|
|
102
|
+
helper.clients.A.off("delta", cb);
|
|
103
|
+
});
|
|
99
104
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const helper = new reconnectHelper_js_1.ReconnectTestHelper();
|
|
103
|
-
helper.clients.A.on("delta", cb);
|
|
104
|
-
const text = "abcdef";
|
|
105
|
-
helper.insertText("B", 0, text);
|
|
106
|
-
helper.processAllOps();
|
|
107
|
-
node_assert_1.strict.equal(length, text.length);
|
|
108
|
-
helper.obliterateRange("B", 0, text.length);
|
|
109
|
-
helper.obliterateRange("C", 0, text.length);
|
|
110
|
-
helper.processAllOps();
|
|
111
|
-
node_assert_1.strict.equal(length, 0);
|
|
112
|
-
helper.logger.validate();
|
|
113
|
-
helper.clients.A.off("delta", cb);
|
|
114
|
-
});
|
|
115
|
-
describe("insert into obliterated range", () => {
|
|
116
|
-
const text = "abcdef";
|
|
117
|
-
it("insert first", () => {
|
|
118
|
-
const helper = new reconnectHelper_js_1.ReconnectTestHelper();
|
|
105
|
+
it("overlapping obliterate and obliterate", () => {
|
|
106
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
119
107
|
helper.clients.A.on("delta", cb);
|
|
108
|
+
const text = "abcdef";
|
|
120
109
|
helper.insertText("B", 0, text);
|
|
121
110
|
helper.processAllOps();
|
|
122
111
|
node_assert_1.strict.equal(length, text.length);
|
|
123
|
-
helper.
|
|
112
|
+
helper.obliterateRange("B", 0, text.length);
|
|
124
113
|
helper.obliterateRange("C", 0, text.length);
|
|
125
114
|
helper.processAllOps();
|
|
126
115
|
node_assert_1.strict.equal(length, 0);
|
|
127
116
|
helper.logger.validate();
|
|
128
117
|
helper.clients.A.off("delta", cb);
|
|
129
118
|
});
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
119
|
+
describe("insert into obliterated range", () => {
|
|
120
|
+
const text = "abcdef";
|
|
121
|
+
it("insert first", () => {
|
|
122
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
123
|
+
helper.clients.A.on("delta", cb);
|
|
124
|
+
helper.insertText("B", 0, text);
|
|
125
|
+
helper.processAllOps();
|
|
126
|
+
node_assert_1.strict.equal(length, text.length);
|
|
127
|
+
helper.insertText("B", 3, text);
|
|
128
|
+
helper.obliterateRange("C", 0, text.length);
|
|
129
|
+
helper.processAllOps();
|
|
130
|
+
node_assert_1.strict.equal(length, 0);
|
|
131
|
+
helper.logger.validate();
|
|
132
|
+
helper.clients.A.off("delta", cb);
|
|
133
|
+
});
|
|
134
|
+
it("obliterate first", () => {
|
|
135
|
+
const helper = new clientTestHelper_js_1.ClientTestHelper({ mergeTreeEnableSidedObliterate });
|
|
136
|
+
helper.clients.A.on("delta", cb);
|
|
137
|
+
helper.insertText("B", 0, text);
|
|
138
|
+
helper.processAllOps();
|
|
139
|
+
node_assert_1.strict.equal(length, text.length);
|
|
140
|
+
helper.obliterateRange("C", 0, text.length);
|
|
141
|
+
helper.insertText("B", 3, text);
|
|
142
|
+
helper.processAllOps();
|
|
143
|
+
node_assert_1.strict.equal(length, 0);
|
|
144
|
+
helper.logger.validate();
|
|
145
|
+
helper.clients.A.off("delta", cb);
|
|
146
|
+
});
|
|
142
147
|
});
|
|
143
148
|
});
|
|
144
|
-
}
|
|
149
|
+
}
|
|
145
150
|
//# sourceMappingURL=obliterate.deltaCallback.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obliterate.deltaCallback.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.deltaCallback.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAG/C,sCAA+C;AAE/C,6DAA2D;AAC3D,iDAA8D;AAE9D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAC1C,IAAA,2CAA4B,GAAE,CAAC;IAE/B,IAAI,MAAc,CAAC;IACnB,IAAI,EAA0B,CAAC;IAE/B,UAAU,CAAC,GAAG,EAAE;QACf,MAAM,GAAG,CAAC,CAAC;QACX,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAQ,EAAE;YAChC,QAAQ,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;gBACxB,KAAK,2BAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,SAAS,CAAC,aAAa,EAAE,CAAC;wBACnD,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;oBAChC,CAAC;oBACD,MAAM;gBACP,CAAC;gBACD,KAAK,2BAAkB,CAAC,MAAM,CAAC;gBAC/B,KAAK,2BAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;oBACpC,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,SAAS,CAAC,aAAa,EAAE,CAAC;wBACnD,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;oBAChC,CAAC;oBACD,MAAM;gBACP,CAAC;gBACD,QAAQ;YACT,CAAC;QACF,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAC9B,MAAM,MAAM,GAAG,IAAI,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C5C,MAAM,CAAC,aAAa,EAAE,CAAC;YACvB,oBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAExB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAEzB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC3B,MAAM,MAAM,GAAG,IAAI,wCAAmB,EAAE,CAAC;YAEzC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAEjC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,aAAa,EAAE,CAAC;YACvB,oBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,aAAa,EAAE,CAAC;YACvB,oBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAExB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAEzB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { MergeTreeDeltaCallback } from \"../mergeTreeDeltaCallback.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { ReconnectTestHelper } from \"./reconnectHelper.js\";\nimport { useStrictPartialLengthChecks } from \"./testUtils.js\";\n\ndescribe(\"obliterate delta callback\", () => {\n\tuseStrictPartialLengthChecks();\n\n\tlet length: number;\n\tlet cb: MergeTreeDeltaCallback;\n\n\tbeforeEach(() => {\n\t\tlength = 0;\n\t\tcb = (opArgs, deltaArgs): void => {\n\t\t\tswitch (opArgs.op.type) {\n\t\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\t\tfor (const { segment } of deltaArgs.deltaSegments) {\n\t\t\t\t\t\tlength += segment.cachedLength;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.REMOVE:\n\t\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\t\tfor (const { segment } of deltaArgs.deltaSegments) {\n\t\t\t\t\t\tlength -= segment.cachedLength;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t}\n\t\t};\n\t});\n\n\tdescribe(\"is invoked\", () => {\n\t\tit(\"on local obliterate\", () => {\n\t\t\tconst helper = new ReconnectTestHelper();\n\n\t\t\tlet count = 0;\n\n\t\t\thelper.clients.A.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\t\tif (opArgs.op.type === MergeTreeDeltaType.OBLITERATE) {\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\thelper.insertText(\"A\", 0, \"a\");\n\t\t\tassert.equal(count, 0);\n\t\t\thelper.obliterateRange(\"A\", 0, 1);\n\t\t\tassert.equal(count, 1);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(count, 1);\n\t\t\tassert.equal(helper.clients.A.getText(), \"\");\n\n\t\t\thelper.logger.validate();\n\t\t});\n\n\t\tit(\"on remote obliterate\", () => {\n\t\t\tconst helper = new ReconnectTestHelper();\n\n\t\t\tlet count = 0;\n\n\t\t\thelper.clients.A.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\t\tif (opArgs.op.type === MergeTreeDeltaType.OBLITERATE) {\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\thelper.insertText(\"B\", 0, \"a\");\n\t\t\tassert.equal(count, 0);\n\t\t\thelper.obliterateRange(\"B\", 0, 1);\n\t\t\tassert.equal(count, 0);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(count, 1);\n\t\t\tassert.equal(helper.clients.A.getText(), \"\");\n\n\t\t\thelper.logger.validate();\n\t\t});\n\t});\n\n\tdescribe(\"overlapping obliterate and remove\", () => {\n\t\tconst text = \"abcdef\";\n\n\t\tit(\"remove first\", () => {\n\t\t\tconst helper = new ReconnectTestHelper();\n\n\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\thelper.insertText(\"A\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, text.length);\n\t\t\thelper.removeRange(\"B\", 0, text.length);\n\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, 0);\n\n\t\t\thelper.logger.validate();\n\n\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t});\n\n\t\tit(\"obliterate first\", () => {\n\t\t\tconst helper = new ReconnectTestHelper();\n\n\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, text.length);\n\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\thelper.removeRange(\"B\", 0, text.length);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, 0);\n\n\t\t\thelper.logger.validate();\n\n\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t});\n\t});\n\n\tit(\"overlapping obliterate and obliterate\", () => {\n\t\tconst helper = new ReconnectTestHelper();\n\n\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\tconst text = \"abcdef\";\n\n\t\thelper.insertText(\"B\", 0, text);\n\t\thelper.processAllOps();\n\t\tassert.equal(length, text.length);\n\t\thelper.obliterateRange(\"B\", 0, text.length);\n\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\thelper.processAllOps();\n\t\tassert.equal(length, 0);\n\n\t\thelper.logger.validate();\n\n\t\thelper.clients.A.off(\"delta\", cb);\n\t});\n\n\tdescribe(\"insert into obliterated range\", () => {\n\t\tconst text = \"abcdef\";\n\n\t\tit(\"insert first\", () => {\n\t\t\tconst helper = new ReconnectTestHelper();\n\n\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, text.length);\n\t\t\thelper.insertText(\"B\", 3, text);\n\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, 0);\n\n\t\t\thelper.logger.validate();\n\n\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t});\n\n\t\tit(\"obliterate first\", () => {\n\t\t\tconst helper = new ReconnectTestHelper();\n\n\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, text.length);\n\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\thelper.insertText(\"B\", 3, text);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, 0);\n\n\t\t\thelper.logger.validate();\n\n\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t});\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"obliterate.deltaCallback.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.deltaCallback.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAG/C,sCAA+C;AAE/C,+DAAyD;AACzD,iDAA8D;AAE9D,KAAK,MAAM,8BAA8B,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J,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { MergeTreeDeltaCallback } from \"../mergeTreeDeltaCallback.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { ClientTestHelper } from \"./clientTestHelper.js\";\nimport { useStrictPartialLengthChecks } from \"./testUtils.js\";\n\nfor (const mergeTreeEnableSidedObliterate of [true, false]) {\n\tdescribe(`obliterate delta callback enableSidedObliterate = ${mergeTreeEnableSidedObliterate}`, () => {\n\t\tuseStrictPartialLengthChecks();\n\n\t\tlet length: number;\n\t\tlet cb: MergeTreeDeltaCallback;\n\n\t\tbeforeEach(() => {\n\t\t\tlength = 0;\n\t\t\tcb = (opArgs, deltaArgs): void => {\n\t\t\t\tswitch (opArgs.op.type) {\n\t\t\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\t\t\tfor (const { segment } of deltaArgs.deltaSegments) {\n\t\t\t\t\t\t\tlength += segment.cachedLength;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase MergeTreeDeltaType.REMOVE:\n\t\t\t\t\tcase MergeTreeDeltaType.OBLITERATE_SIDED:\n\t\t\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\t\t\tfor (const { segment } of deltaArgs.deltaSegments) {\n\t\t\t\t\t\t\tlength -= segment.cachedLength;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\n\t\tdescribe(\"is invoked\", () => {\n\t\t\tit(\"on local obliterate\", () => {\n\t\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\t\tlet count = 0;\n\n\t\t\t\thelper.clients.A.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\topArgs.op.type === MergeTreeDeltaType.OBLITERATE ||\n\t\t\t\t\t\topArgs.op.type === MergeTreeDeltaType.OBLITERATE_SIDED\n\t\t\t\t\t) {\n\t\t\t\t\t\tcount += 1;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\thelper.insertText(\"A\", 0, \"a\");\n\t\t\t\tassert.equal(count, 0);\n\t\t\t\thelper.obliterateRange(\"A\", 0, 1);\n\t\t\t\tassert.equal(count, 1);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(count, 1);\n\t\t\t\tassert.equal(helper.clients.A.getText(), \"\");\n\n\t\t\t\thelper.logger.validate();\n\t\t\t});\n\n\t\t\tit(\"on remote obliterate\", () => {\n\t\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\t\tlet count = 0;\n\n\t\t\t\thelper.clients.A.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\topArgs.op.type === MergeTreeDeltaType.OBLITERATE ||\n\t\t\t\t\t\topArgs.op.type === MergeTreeDeltaType.OBLITERATE_SIDED\n\t\t\t\t\t) {\n\t\t\t\t\t\tcount += 1;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\thelper.insertText(\"B\", 0, \"a\");\n\t\t\t\tassert.equal(count, 0);\n\t\t\t\thelper.obliterateRange(\"B\", 0, 1);\n\t\t\t\tassert.equal(count, 0);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(count, 1);\n\t\t\t\tassert.equal(helper.clients.A.getText(), \"\");\n\n\t\t\t\thelper.logger.validate();\n\t\t\t});\n\t\t});\n\n\t\tdescribe(\"overlapping obliterate and remove\", () => {\n\t\t\tconst text = \"abcdef\";\n\n\t\t\tit(\"remove first\", () => {\n\t\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\t\thelper.insertText(\"A\", 0, text);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, text.length);\n\t\t\t\thelper.removeRange(\"B\", 0, text.length);\n\t\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, 0);\n\n\t\t\t\thelper.logger.validate();\n\n\t\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t\t});\n\n\t\t\tit(\"obliterate first\", () => {\n\t\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, text.length);\n\t\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\t\thelper.removeRange(\"B\", 0, text.length);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, 0);\n\n\t\t\t\thelper.logger.validate();\n\n\t\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t\t});\n\t\t});\n\n\t\tit(\"overlapping obliterate and obliterate\", () => {\n\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\tconst text = \"abcdef\";\n\n\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, text.length);\n\t\t\thelper.obliterateRange(\"B\", 0, text.length);\n\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\thelper.processAllOps();\n\t\t\tassert.equal(length, 0);\n\n\t\t\thelper.logger.validate();\n\n\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t});\n\n\t\tdescribe(\"insert into obliterated range\", () => {\n\t\t\tconst text = \"abcdef\";\n\n\t\t\tit(\"insert first\", () => {\n\t\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, text.length);\n\t\t\t\thelper.insertText(\"B\", 3, text);\n\t\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, 0);\n\n\t\t\t\thelper.logger.validate();\n\n\t\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t\t});\n\n\t\t\tit(\"obliterate first\", () => {\n\t\t\t\tconst helper = new ClientTestHelper({ mergeTreeEnableSidedObliterate });\n\n\t\t\t\thelper.clients.A.on(\"delta\", cb);\n\n\t\t\t\thelper.insertText(\"B\", 0, text);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, text.length);\n\t\t\t\thelper.obliterateRange(\"C\", 0, text.length);\n\t\t\t\thelper.insertText(\"B\", 3, text);\n\t\t\t\thelper.processAllOps();\n\t\t\t\tassert.equal(length, 0);\n\n\t\t\t\thelper.logger.validate();\n\n\t\t\t\thelper.clients.A.off(\"delta\", cb);\n\t\t\t});\n\t\t});\n\t});\n}\n"]}
|
|
@@ -6,28 +6,9 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const node_assert_1 = require("node:assert");
|
|
8
8
|
const sequencePlace_js_1 = require("../sequencePlace.js");
|
|
9
|
-
const
|
|
10
|
-
function createObliterateTestBody({ action, expectedText }) {
|
|
11
|
-
return () => {
|
|
12
|
-
const events = [];
|
|
13
|
-
const helper = new reconnectHelper_js_1.ReconnectTestHelper({
|
|
14
|
-
mergeTreeEnableSidedObliterate: true,
|
|
15
|
-
});
|
|
16
|
-
helper.clients.A.on("delta", (opArgs, deltaArgs) => {
|
|
17
|
-
events.push(deltaArgs.operation);
|
|
18
|
-
});
|
|
19
|
-
action(helper);
|
|
20
|
-
helper.processAllOps();
|
|
21
|
-
helper.logger.validate({ baseText: expectedText });
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function itCorrectlyObliterates(args) {
|
|
25
|
-
return it(args.title, createObliterateTestBody(args));
|
|
26
|
-
}
|
|
27
|
-
itCorrectlyObliterates.skip = (args) => it.skip(args.title, createObliterateTestBody(args));
|
|
28
|
-
itCorrectlyObliterates.only = (args) => it.only(args.title, createObliterateTestBody(args));
|
|
9
|
+
const testUtils_js_1 = require("./testUtils.js");
|
|
29
10
|
describe("obliterate", () => {
|
|
30
|
-
itCorrectlyObliterates({
|
|
11
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
31
12
|
title: "Obliterate adjacent insert",
|
|
32
13
|
action: (helper) => {
|
|
33
14
|
helper.insertText("A", 0, "|ABC>");
|
|
@@ -41,7 +22,7 @@ describe("obliterate", () => {
|
|
|
41
22
|
},
|
|
42
23
|
expectedText: "|BBB>",
|
|
43
24
|
});
|
|
44
|
-
itCorrectlyObliterates({
|
|
25
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
45
26
|
title: "Obliterate adjacent insert followed by obliterate",
|
|
46
27
|
action: (helper) => {
|
|
47
28
|
helper.insertText("A", 0, "0xx12345678");
|
|
@@ -58,7 +39,7 @@ describe("obliterate", () => {
|
|
|
58
39
|
},
|
|
59
40
|
expectedText: "0678",
|
|
60
41
|
});
|
|
61
|
-
itCorrectlyObliterates({
|
|
42
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
62
43
|
title: "does not obliterate non-adjacent insert",
|
|
63
44
|
action: (helper) => {
|
|
64
45
|
helper.insertText("A", 0, "hello world");
|
|
@@ -70,7 +51,7 @@ describe("obliterate", () => {
|
|
|
70
51
|
expectedText: "XYZhe world",
|
|
71
52
|
});
|
|
72
53
|
describe("removes prior insert from same client", () => {
|
|
73
|
-
itCorrectlyObliterates({
|
|
54
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
74
55
|
title: "when the insert is unacked",
|
|
75
56
|
action: (helper) => {
|
|
76
57
|
helper.insertText("A", 0, "ABC");
|
|
@@ -78,7 +59,7 @@ describe("obliterate", () => {
|
|
|
78
59
|
},
|
|
79
60
|
expectedText: "AC",
|
|
80
61
|
});
|
|
81
|
-
itCorrectlyObliterates({
|
|
62
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
82
63
|
title: "when the insert is acked",
|
|
83
64
|
action: (helper) => {
|
|
84
65
|
helper.insertText("A", 0, "ABC");
|
|
@@ -89,7 +70,7 @@ describe("obliterate", () => {
|
|
|
89
70
|
});
|
|
90
71
|
});
|
|
91
72
|
describe("does not remove subsequent insert from the same client", () => {
|
|
92
|
-
itCorrectlyObliterates({
|
|
73
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
93
74
|
title: "when the obliterate is unacked",
|
|
94
75
|
action: (helper) => {
|
|
95
76
|
helper.insertText("A", 0, "ABC");
|
|
@@ -98,7 +79,7 @@ describe("obliterate", () => {
|
|
|
98
79
|
},
|
|
99
80
|
expectedText: "ADC",
|
|
100
81
|
});
|
|
101
|
-
itCorrectlyObliterates({
|
|
82
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
102
83
|
title: "when the obliterate is unacked",
|
|
103
84
|
action: (helper) => {
|
|
104
85
|
helper.insertText("A", 0, "ABC");
|
|
@@ -109,7 +90,7 @@ describe("obliterate", () => {
|
|
|
109
90
|
expectedText: "ADC",
|
|
110
91
|
});
|
|
111
92
|
});
|
|
112
|
-
itCorrectlyObliterates({
|
|
93
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
113
94
|
title: "obliterate, then insert at the end of the string",
|
|
114
95
|
action: (helper) => {
|
|
115
96
|
helper.insertText("A", 0, "hello world");
|
|
@@ -119,7 +100,7 @@ describe("obliterate", () => {
|
|
|
119
100
|
},
|
|
120
101
|
expectedText: "hello",
|
|
121
102
|
});
|
|
122
|
-
itCorrectlyObliterates({
|
|
103
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
123
104
|
title: "insert, then obliterate at the end of the string",
|
|
124
105
|
action: (helper) => {
|
|
125
106
|
helper.insertText("A", 0, "hello world");
|
|
@@ -129,7 +110,7 @@ describe("obliterate", () => {
|
|
|
129
110
|
},
|
|
130
111
|
expectedText: "hello",
|
|
131
112
|
});
|
|
132
|
-
itCorrectlyObliterates({
|
|
113
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
133
114
|
title: "obliterate, then insert at the end of the string",
|
|
134
115
|
action: (helper) => {
|
|
135
116
|
helper.insertText("A", 0, "hello world");
|
|
@@ -139,7 +120,7 @@ describe("obliterate", () => {
|
|
|
139
120
|
},
|
|
140
121
|
expectedText: "hello",
|
|
141
122
|
});
|
|
142
|
-
itCorrectlyObliterates({
|
|
123
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
143
124
|
title: "insert, then obliterate at the end of the string",
|
|
144
125
|
action: (helper) => {
|
|
145
126
|
helper.insertText("A", 0, "hello world");
|
|
@@ -151,7 +132,7 @@ describe("obliterate", () => {
|
|
|
151
132
|
});
|
|
152
133
|
describe("zero length", () => {
|
|
153
134
|
// TODO: #17785: Allow start and end to be used as obliteration range endpoints.
|
|
154
|
-
itCorrectlyObliterates.skip({
|
|
135
|
+
testUtils_js_1.itCorrectlyObliterates.skip({
|
|
155
136
|
title: "zero length obliterate at the start of the string",
|
|
156
137
|
action: (helper) => {
|
|
157
138
|
helper.insertText("A", 0, "hello world");
|
|
@@ -161,7 +142,7 @@ describe("obliterate", () => {
|
|
|
161
142
|
},
|
|
162
143
|
expectedText: "hello world",
|
|
163
144
|
});
|
|
164
|
-
itCorrectlyObliterates({
|
|
145
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
165
146
|
title: "zero length obliterate in the middle of the string",
|
|
166
147
|
action: (helper) => {
|
|
167
148
|
helper.insertText("A", 0, "hello world");
|
|
@@ -172,7 +153,7 @@ describe("obliterate", () => {
|
|
|
172
153
|
expectedText: "hello world",
|
|
173
154
|
});
|
|
174
155
|
// TODO: #17785: Allow start and end to be used as obliteration range endpoints.
|
|
175
|
-
itCorrectlyObliterates.skip({
|
|
156
|
+
testUtils_js_1.itCorrectlyObliterates.skip({
|
|
176
157
|
title: "zero length obliterate at the end of the string",
|
|
177
158
|
action: (helper) => {
|
|
178
159
|
helper.insertText("A", 0, "hello world");
|
|
@@ -185,7 +166,7 @@ describe("obliterate", () => {
|
|
|
185
166
|
});
|
|
186
167
|
});
|
|
187
168
|
describe("overlapping edits", () => {
|
|
188
|
-
itCorrectlyObliterates({
|
|
169
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
189
170
|
title: "overlapping obliterate and obliterate",
|
|
190
171
|
action: (helper) => {
|
|
191
172
|
const text = "abcdef";
|
|
@@ -196,7 +177,7 @@ describe("overlapping edits", () => {
|
|
|
196
177
|
},
|
|
197
178
|
expectedText: "",
|
|
198
179
|
});
|
|
199
|
-
itCorrectlyObliterates({
|
|
180
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
200
181
|
title: "adjacent obliterates",
|
|
201
182
|
action: (helper) => {
|
|
202
183
|
helper.insertText("A", 0, "hello world");
|
|
@@ -206,7 +187,7 @@ describe("overlapping edits", () => {
|
|
|
206
187
|
},
|
|
207
188
|
expectedText: "heworld",
|
|
208
189
|
});
|
|
209
|
-
itCorrectlyObliterates({
|
|
190
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
210
191
|
title: "remove within obliterated range",
|
|
211
192
|
action: (helper) => {
|
|
212
193
|
helper.insertText("A", 0, "hello world");
|
|
@@ -216,7 +197,7 @@ describe("overlapping edits", () => {
|
|
|
216
197
|
},
|
|
217
198
|
expectedText: "heworld",
|
|
218
199
|
});
|
|
219
|
-
itCorrectlyObliterates({
|
|
200
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
220
201
|
title: "obliterate, then remove adjacent to range start",
|
|
221
202
|
action: (helper) => {
|
|
222
203
|
helper.insertText("A", 0, "hello world");
|
|
@@ -226,7 +207,7 @@ describe("overlapping edits", () => {
|
|
|
226
207
|
},
|
|
227
208
|
expectedText: "hworld",
|
|
228
209
|
});
|
|
229
|
-
itCorrectlyObliterates({
|
|
210
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
230
211
|
title: "obliterate, then remove adjacent to range end",
|
|
231
212
|
action: (helper) => {
|
|
232
213
|
helper.insertText("A", 0, "hello world");
|
|
@@ -236,7 +217,7 @@ describe("overlapping edits", () => {
|
|
|
236
217
|
},
|
|
237
218
|
expectedText: "heworld",
|
|
238
219
|
});
|
|
239
|
-
itCorrectlyObliterates({
|
|
220
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
240
221
|
title: "remove, then obliterate adjacent to range start",
|
|
241
222
|
action: (helper) => {
|
|
242
223
|
helper.insertText("A", 0, "hello world");
|
|
@@ -246,7 +227,7 @@ describe("overlapping edits", () => {
|
|
|
246
227
|
},
|
|
247
228
|
expectedText: "heworld",
|
|
248
229
|
});
|
|
249
|
-
itCorrectlyObliterates({
|
|
230
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
250
231
|
title: "remove, then obliterate adjacent to range end",
|
|
251
232
|
action: (helper) => {
|
|
252
233
|
helper.insertText("A", 0, "hello world");
|
|
@@ -259,7 +240,7 @@ describe("overlapping edits", () => {
|
|
|
259
240
|
// This test is somewhat arbitrary: it's a minimized fuzz test failure that ended up root-causing to an issue
|
|
260
241
|
// in SortedSegmentSet (local references were not compared correctly when put at various offsets). We also have
|
|
261
242
|
// more direct unit tests for that, but this is a good sanity check and adds some extra verification for concurrent obliterates.
|
|
262
|
-
itCorrectlyObliterates({
|
|
243
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
263
244
|
title: "overlapping obliterates with third client inserting",
|
|
264
245
|
action: (helper) => {
|
|
265
246
|
helper.insertText("A", 0, "0123456789");
|
|
@@ -272,37 +253,6 @@ describe("overlapping edits", () => {
|
|
|
272
253
|
expectedText: "09",
|
|
273
254
|
});
|
|
274
255
|
});
|
|
275
|
-
describe.skip("reconnect", () => {
|
|
276
|
-
itCorrectlyObliterates({
|
|
277
|
-
title: "add text, disconnect, obliterate, reconnect, insert adjacent to obliterated range",
|
|
278
|
-
action: (helper) => {
|
|
279
|
-
helper.insertText("A", 0, "hello world");
|
|
280
|
-
helper.processAllOps();
|
|
281
|
-
helper.disconnect(["C"]);
|
|
282
|
-
const op = helper.obliterateRangeLocal("C", { pos: 1, side: sequencePlace_js_1.Side.After }, { pos: 4, side: sequencePlace_js_1.Side.After });
|
|
283
|
-
helper.reconnect(["C"]);
|
|
284
|
-
helper.submitDisconnectedOp("C", op);
|
|
285
|
-
helper.processAllOps();
|
|
286
|
-
// inserting adjacent to the obliterated range start
|
|
287
|
-
helper.insertText("A", 2, "123");
|
|
288
|
-
},
|
|
289
|
-
expectedText: "heo world",
|
|
290
|
-
});
|
|
291
|
-
itCorrectlyObliterates({
|
|
292
|
-
title: "add text, disconnect, obliterate, insert adjacent to obliterated range, reconnect",
|
|
293
|
-
action: (helper) => {
|
|
294
|
-
helper.insertText("A", 0, "hello world");
|
|
295
|
-
helper.processAllOps();
|
|
296
|
-
helper.disconnect(["C"]);
|
|
297
|
-
const op = helper.obliterateRangeLocal("C", { pos: 1, side: sequencePlace_js_1.Side.After }, { pos: 4, side: sequencePlace_js_1.Side.After });
|
|
298
|
-
// inserting adjacent to the obliterated range start
|
|
299
|
-
helper.insertText("A", 2, "123");
|
|
300
|
-
helper.reconnect(["C"]);
|
|
301
|
-
helper.submitDisconnectedOp("C", op);
|
|
302
|
-
},
|
|
303
|
-
expectedText: "heo world",
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
256
|
describe("sided obliterates", () => {
|
|
307
257
|
/**
|
|
308
258
|
* All test cases will operate on the same numerical positions, but differ on their sidedness:
|
|
@@ -314,7 +264,7 @@ describe("sided obliterates", () => {
|
|
|
314
264
|
* 6. A expand neither endpoint, B expand end = expand end endpoint
|
|
315
265
|
* before = 0, after = 1
|
|
316
266
|
*/
|
|
317
|
-
itCorrectlyObliterates({
|
|
267
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
318
268
|
title: "1. A expand both endpoints, B expand neither endpoint",
|
|
319
269
|
action: (helper) => {
|
|
320
270
|
helper.insertText("A", 0, "hello world");
|
|
@@ -330,7 +280,7 @@ describe("sided obliterates", () => {
|
|
|
330
280
|
},
|
|
331
281
|
expectedText: "he world",
|
|
332
282
|
});
|
|
333
|
-
itCorrectlyObliterates({
|
|
283
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
334
284
|
title: "2. A expand start endpoint, B expand end endpoint",
|
|
335
285
|
action: (helper) => {
|
|
336
286
|
// currently this is the example from obliterate notation loop doc
|
|
@@ -348,7 +298,7 @@ describe("sided obliterates", () => {
|
|
|
348
298
|
},
|
|
349
299
|
expectedText: "AC",
|
|
350
300
|
});
|
|
351
|
-
itCorrectlyObliterates({
|
|
301
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
352
302
|
title: "3. A expand both endpoints, B expand start",
|
|
353
303
|
action: (helper) => {
|
|
354
304
|
helper.insertText("A", 0, "hello world");
|
|
@@ -363,7 +313,7 @@ describe("sided obliterates", () => {
|
|
|
363
313
|
},
|
|
364
314
|
expectedText: "he world",
|
|
365
315
|
});
|
|
366
|
-
itCorrectlyObliterates({
|
|
316
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
367
317
|
title: "4. A expand both endpoints, B expand end",
|
|
368
318
|
action: (helper) => {
|
|
369
319
|
helper.insertText("A", 0, "hello world");
|
|
@@ -378,7 +328,7 @@ describe("sided obliterates", () => {
|
|
|
378
328
|
},
|
|
379
329
|
expectedText: "he world",
|
|
380
330
|
});
|
|
381
|
-
itCorrectlyObliterates({
|
|
331
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
382
332
|
title: "5. A expand neither endpoint, B expand start",
|
|
383
333
|
action: (helper) => {
|
|
384
334
|
helper.insertText("A", 0, "hello world");
|
|
@@ -397,7 +347,7 @@ describe("sided obliterates", () => {
|
|
|
397
347
|
},
|
|
398
348
|
expectedText: "he456 world",
|
|
399
349
|
});
|
|
400
|
-
itCorrectlyObliterates({
|
|
350
|
+
(0, testUtils_js_1.itCorrectlyObliterates)({
|
|
401
351
|
title: "6. A expand neither endpoint, B expand end",
|
|
402
352
|
action: (helper) => {
|
|
403
353
|
helper.insertText("A", 0, "hello world");
|