document-model 6.0.0-dev.11 → 6.0.0-dev.110
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/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +216 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.mts +62 -0
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +151 -0
- package/dist/node.mjs.map +1 -0
- package/package.json +15 -24
- package/dist/src/core/actions.d.ts +0 -87
- package/dist/src/core/actions.d.ts.map +0 -1
- package/dist/src/core/actions.js +0 -187
- package/dist/src/core/actions.js.map +0 -1
- package/dist/src/core/crypto.d.ts +0 -8
- package/dist/src/core/crypto.d.ts.map +0 -1
- package/dist/src/core/crypto.js +0 -68
- package/dist/src/core/crypto.js.map +0 -1
- package/dist/src/core/documents.d.ts +0 -146
- package/dist/src/core/documents.d.ts.map +0 -1
- package/dist/src/core/documents.js +0 -814
- package/dist/src/core/documents.js.map +0 -1
- package/dist/src/core/errors.d.ts +0 -21
- package/dist/src/core/errors.d.ts.map +0 -1
- package/dist/src/core/errors.js +0 -46
- package/dist/src/core/errors.js.map +0 -1
- package/dist/src/core/files.d.ts +0 -14
- package/dist/src/core/files.d.ts.map +0 -1
- package/dist/src/core/files.js +0 -65
- package/dist/src/core/files.js.map +0 -1
- package/dist/src/core/header.d.ts +0 -63
- package/dist/src/core/header.d.ts.map +0 -1
- package/dist/src/core/header.js +0 -178
- package/dist/src/core/header.js.map +0 -1
- package/dist/src/core/index.d.ts +0 -13
- package/dist/src/core/index.d.ts.map +0 -1
- package/dist/src/core/index.js +0 -13
- package/dist/src/core/index.js.map +0 -1
- package/dist/src/core/node.d.ts +0 -53
- package/dist/src/core/node.d.ts.map +0 -1
- package/dist/src/core/node.js +0 -139
- package/dist/src/core/node.js.map +0 -1
- package/dist/src/core/operations.d.ts +0 -48
- package/dist/src/core/operations.d.ts.map +0 -1
- package/dist/src/core/operations.js +0 -122
- package/dist/src/core/operations.js.map +0 -1
- package/dist/src/core/ph-types.d.ts +0 -315
- package/dist/src/core/ph-types.d.ts.map +0 -1
- package/dist/src/core/ph-types.js +0 -15
- package/dist/src/core/ph-types.js.map +0 -1
- package/dist/src/core/reducer.d.ts +0 -63
- package/dist/src/core/reducer.d.ts.map +0 -1
- package/dist/src/core/reducer.js +0 -455
- package/dist/src/core/reducer.js.map +0 -1
- package/dist/src/core/schemas.d.ts +0 -69
- package/dist/src/core/schemas.d.ts.map +0 -1
- package/dist/src/core/schemas.js +0 -110
- package/dist/src/core/schemas.js.map +0 -1
- package/dist/src/core/state.d.ts +0 -26
- package/dist/src/core/state.d.ts.map +0 -1
- package/dist/src/core/state.js +0 -56
- package/dist/src/core/state.js.map +0 -1
- package/dist/src/core/types.d.ts +0 -536
- package/dist/src/core/types.d.ts.map +0 -1
- package/dist/src/core/types.js +0 -2
- package/dist/src/core/types.js.map +0 -1
- package/dist/src/core/utils.d.ts +0 -6
- package/dist/src/core/utils.d.ts.map +0 -1
- package/dist/src/core/utils.js +0 -15
- package/dist/src/core/utils.js.map +0 -1
- package/dist/src/core/validation.d.ts +0 -4
- package/dist/src/core/validation.d.ts.map +0 -1
- package/dist/src/core/validation.js +0 -27
- package/dist/src/core/validation.js.map +0 -1
- package/dist/src/document-model/actions.d.ts +0 -158
- package/dist/src/document-model/actions.d.ts.map +0 -1
- package/dist/src/document-model/actions.js +0 -111
- package/dist/src/document-model/actions.js.map +0 -1
- package/dist/src/document-model/constants.d.ts +0 -6
- package/dist/src/document-model/constants.d.ts.map +0 -1
- package/dist/src/document-model/constants.js +0 -573
- package/dist/src/document-model/constants.js.map +0 -1
- package/dist/src/document-model/document-schema.d.ts +0 -69
- package/dist/src/document-model/document-schema.d.ts.map +0 -1
- package/dist/src/document-model/document-schema.js +0 -43
- package/dist/src/document-model/document-schema.js.map +0 -1
- package/dist/src/document-model/document-type.d.ts +0 -2
- package/dist/src/document-model/document-type.d.ts.map +0 -1
- package/dist/src/document-model/document-type.js +0 -2
- package/dist/src/document-model/document-type.js.map +0 -1
- package/dist/src/document-model/files.d.ts +0 -5
- package/dist/src/document-model/files.d.ts.map +0 -1
- package/dist/src/document-model/files.js +0 -9
- package/dist/src/document-model/files.js.map +0 -1
- package/dist/src/document-model/index.d.ts +0 -11
- package/dist/src/document-model/index.d.ts.map +0 -1
- package/dist/src/document-model/index.js +0 -11
- package/dist/src/document-model/index.js.map +0 -1
- package/dist/src/document-model/module.d.ts +0 -3
- package/dist/src/document-model/module.d.ts.map +0 -1
- package/dist/src/document-model/module.js +0 -24
- package/dist/src/document-model/module.js.map +0 -1
- package/dist/src/document-model/reducers.d.ts +0 -11
- package/dist/src/document-model/reducers.d.ts.map +0 -1
- package/dist/src/document-model/reducers.js +0 -618
- package/dist/src/document-model/reducers.js.map +0 -1
- package/dist/src/document-model/schemas.d.ts +0 -189
- package/dist/src/document-model/schemas.d.ts.map +0 -1
- package/dist/src/document-model/schemas.js +0 -388
- package/dist/src/document-model/schemas.js.map +0 -1
- package/dist/src/document-model/state.d.ts +0 -15
- package/dist/src/document-model/state.d.ts.map +0 -1
- package/dist/src/document-model/state.js +0 -75
- package/dist/src/document-model/state.js.map +0 -1
- package/dist/src/document-model/types.d.ts +0 -679
- package/dist/src/document-model/types.d.ts.map +0 -1
- package/dist/src/document-model/types.js +0 -2
- package/dist/src/document-model/types.js.map +0 -1
- package/dist/src/document-model/validation.d.ts +0 -32
- package/dist/src/document-model/validation.d.ts.map +0 -1
- package/dist/src/document-model/validation.js +0 -166
- package/dist/src/document-model/validation.js.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/test/document/crypto.test.d.ts +0 -2
- package/dist/test/document/crypto.test.d.ts.map +0 -1
- package/dist/test/document/crypto.test.js +0 -195
- package/dist/test/document/crypto.test.js.map +0 -1
- package/dist/test/document/event-vs-command.test.d.ts +0 -2
- package/dist/test/document/event-vs-command.test.d.ts.map +0 -1
- package/dist/test/document/event-vs-command.test.js +0 -202
- package/dist/test/document/event-vs-command.test.js.map +0 -1
- package/dist/test/document/local.test.d.ts +0 -2
- package/dist/test/document/local.test.d.ts.map +0 -1
- package/dist/test/document/local.test.js +0 -229
- package/dist/test/document/local.test.js.map +0 -1
- package/dist/test/document/operation-id.test.d.ts +0 -2
- package/dist/test/document/operation-id.test.d.ts.map +0 -1
- package/dist/test/document/operation-id.test.js +0 -118
- package/dist/test/document/operation-id.test.js.map +0 -1
- package/dist/test/document/prune.test.d.ts +0 -2
- package/dist/test/document/prune.test.d.ts.map +0 -1
- package/dist/test/document/prune.test.js +0 -159
- package/dist/test/document/prune.test.js.map +0 -1
- package/dist/test/document/reducer.test.d.ts +0 -2
- package/dist/test/document/reducer.test.d.ts.map +0 -1
- package/dist/test/document/reducer.test.js +0 -284
- package/dist/test/document/reducer.test.js.map +0 -1
- package/dist/test/document/skip-operations.test.d.ts +0 -2
- package/dist/test/document/skip-operations.test.d.ts.map +0 -1
- package/dist/test/document/skip-operations.test.js +0 -412
- package/dist/test/document/skip-operations.test.js.map +0 -1
- package/dist/test/document/undo-redo-v2.test.d.ts +0 -2
- package/dist/test/document/undo-redo-v2.test.d.ts.map +0 -1
- package/dist/test/document/undo-redo-v2.test.js +0 -207
- package/dist/test/document/undo-redo-v2.test.js.map +0 -1
- package/dist/test/document/undo-redo.test.d.ts +0 -2
- package/dist/test/document/undo-redo.test.d.ts.map +0 -1
- package/dist/test/document/undo-redo.test.js +0 -413
- package/dist/test/document/undo-redo.test.js.map +0 -1
- package/dist/test/document/utils.test.d.ts +0 -2
- package/dist/test/document/utils.test.d.ts.map +0 -1
- package/dist/test/document/utils.test.js +0 -172
- package/dist/test/document/utils.test.js.map +0 -1
- package/dist/test/document-helpers/addUndo.test.d.ts +0 -2
- package/dist/test/document-helpers/addUndo.test.d.ts.map +0 -1
- package/dist/test/document-helpers/addUndo.test.js +0 -120
- package/dist/test/document-helpers/addUndo.test.js.map +0 -1
- package/dist/test/document-helpers/attachBranch.test.d.ts +0 -2
- package/dist/test/document-helpers/attachBranch.test.d.ts.map +0 -1
- package/dist/test/document-helpers/attachBranch.test.js +0 -364
- package/dist/test/document-helpers/attachBranch.test.js.map +0 -1
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +0 -2
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts.map +0 -1
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js +0 -252
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js.map +0 -1
- package/dist/test/document-helpers/conflictResolution.test.d.ts +0 -2
- package/dist/test/document-helpers/conflictResolution.test.d.ts.map +0 -1
- package/dist/test/document-helpers/conflictResolution.test.js +0 -109
- package/dist/test/document-helpers/conflictResolution.test.js.map +0 -1
- package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/filterDuplicatedOperations.test.js +0 -126
- package/dist/test/document-helpers/filterDuplicatedOperations.test.js.map +0 -1
- package/dist/test/document-helpers/garbageCollect.test.d.ts +0 -2
- package/dist/test/document-helpers/garbageCollect.test.d.ts.map +0 -1
- package/dist/test/document-helpers/garbageCollect.test.js +0 -136
- package/dist/test/document-helpers/garbageCollect.test.js.map +0 -1
- package/dist/test/document-helpers/groupOperationsByScope.test.d.ts +0 -2
- package/dist/test/document-helpers/groupOperationsByScope.test.d.ts.map +0 -1
- package/dist/test/document-helpers/groupOperationsByScope.test.js +0 -102
- package/dist/test/document-helpers/groupOperationsByScope.test.js.map +0 -1
- package/dist/test/document-helpers/merge.test.d.ts +0 -2
- package/dist/test/document-helpers/merge.test.d.ts.map +0 -1
- package/dist/test/document-helpers/merge.test.js +0 -906
- package/dist/test/document-helpers/merge.test.js.map +0 -1
- package/dist/test/document-helpers/nextSkipNumber.test.d.ts +0 -2
- package/dist/test/document-helpers/nextSkipNumber.test.d.ts.map +0 -1
- package/dist/test/document-helpers/nextSkipNumber.test.js +0 -135
- package/dist/test/document-helpers/nextSkipNumber.test.js.map +0 -1
- package/dist/test/document-helpers/prepareOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/prepareOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/prepareOperations.test.js +0 -304
- package/dist/test/document-helpers/prepareOperations.test.js.map +0 -1
- package/dist/test/document-helpers/removeExistingOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/removeExistingOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/removeExistingOperations.test.js +0 -177
- package/dist/test/document-helpers/removeExistingOperations.test.js.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts +0 -2
- package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestamp.test.js +0 -148
- package/dist/test/document-helpers/reshuffleByTimestamp.test.js.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +0 -2
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js +0 -200
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js.map +0 -1
- package/dist/test/document-helpers/skipHeaderOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/skipHeaderOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/skipHeaderOperations.test.js +0 -72
- package/dist/test/document-helpers/skipHeaderOperations.test.js.map +0 -1
- package/dist/test/document-helpers/sortOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/sortOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/sortOperations.test.js +0 -101
- package/dist/test/document-helpers/sortOperations.test.js.map +0 -1
- package/dist/test/document-helpers/split.test.d.ts +0 -2
- package/dist/test/document-helpers/split.test.d.ts.map +0 -1
- package/dist/test/document-helpers/split.test.js +0 -121
- package/dist/test/document-helpers/split.test.js.map +0 -1
- package/dist/test/document-helpers/utils.d.ts +0 -15
- package/dist/test/document-helpers/utils.d.ts.map +0 -1
- package/dist/test/document-helpers/utils.js +0 -61
- package/dist/test/document-helpers/utils.js.map +0 -1
- package/dist/test/document-model/replay.test.d.ts +0 -2
- package/dist/test/document-model/replay.test.d.ts.map +0 -1
- package/dist/test/document-model/replay.test.js +0 -139
- package/dist/test/document-model/replay.test.js.map +0 -1
- package/dist/test/document-model/skip-operations.test.d.ts +0 -2
- package/dist/test/document-model/skip-operations.test.d.ts.map +0 -1
- package/dist/test/document-model/skip-operations.test.js +0 -214
- package/dist/test/document-model/skip-operations.test.js.map +0 -1
- package/dist/test/document-model/validation.test.d.ts +0 -2
- package/dist/test/document-model/validation.test.d.ts.map +0 -1
- package/dist/test/document-model/validation.test.js +0 -451
- package/dist/test/document-model/validation.test.js.map +0 -1
- package/dist/test/document-model/versioning.test.d.ts +0 -2
- package/dist/test/document-model/versioning.test.d.ts.map +0 -1
- package/dist/test/document-model/versioning.test.js +0 -93
- package/dist/test/document-model/versioning.test.js.map +0 -1
- package/dist/test/document-model/zip.test.d.ts +0 -2
- package/dist/test/document-model/zip.test.d.ts.map +0 -1
- package/dist/test/document-model/zip.test.js +0 -79
- package/dist/test/document-model/zip.test.js.map +0 -1
- package/dist/test/helpers.d.ts +0 -77
- package/dist/test/helpers.d.ts.map +0 -1
- package/dist/test/helpers.js +0 -118
- package/dist/test/helpers.js.map +0 -1
- package/dist/test/index.d.ts +0 -4
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -3
- package/dist/test/index.js.map +0 -1
- package/dist/test/types.d.ts +0 -6
- package/dist/test/types.d.ts.map +0 -1
- package/dist/test/types.js +0 -2
- package/dist/test/types.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -7
- package/dist/vitest.config.js.map +0 -1
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
import { baseCreateDocument, garbageCollectDocumentOperations, mapSkippedOperations, replayOperations, } from "document-model/core";
|
|
2
|
-
import { baseCountReducer, countReducer, createCountDocumentState, defaultPHDocumentCreateState, error, fakeOperation, increment, mapOperations, testCreateBaseState, wrappedEmptyReducer, } from "document-model/test";
|
|
3
|
-
import { describe } from "vitest";
|
|
4
|
-
import { setName } from "document-model";
|
|
5
|
-
describe("skip operations", () => {
|
|
6
|
-
describe("skip operation param", () => {
|
|
7
|
-
it("should include skip param in base operations with default value to 0 if not provided", () => {
|
|
8
|
-
let document = baseCreateDocument(defaultPHDocumentCreateState);
|
|
9
|
-
document = wrappedEmptyReducer(document, setName("TEST_1"));
|
|
10
|
-
document = wrappedEmptyReducer(document, setName("TEST_2"));
|
|
11
|
-
document = wrappedEmptyReducer(document, setName("TEST_3"));
|
|
12
|
-
expect(document.header.revision.global).toBe(3);
|
|
13
|
-
const ops = mapOperations(document.operations.global);
|
|
14
|
-
expect(ops.length).toBe(3);
|
|
15
|
-
ops.forEach((op) => {
|
|
16
|
-
expect(op).toHaveProperty("skip", 0);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
it("should include skip param in base operations with provided value", () => {
|
|
20
|
-
let document = baseCreateDocument(defaultPHDocumentCreateState);
|
|
21
|
-
document = wrappedEmptyReducer(document, setName("TEST_1"), undefined, {
|
|
22
|
-
skip: 1,
|
|
23
|
-
ignoreSkipOperations: true,
|
|
24
|
-
});
|
|
25
|
-
document = wrappedEmptyReducer(document, setName("TEST_2"), undefined, {
|
|
26
|
-
skip: 2,
|
|
27
|
-
ignoreSkipOperations: true,
|
|
28
|
-
});
|
|
29
|
-
document = wrappedEmptyReducer(document, setName("TEST_3"), undefined, {
|
|
30
|
-
skip: 3,
|
|
31
|
-
ignoreSkipOperations: true,
|
|
32
|
-
});
|
|
33
|
-
expect(document.header.revision.global).toBe(3);
|
|
34
|
-
const ops = mapOperations(document.operations.global);
|
|
35
|
-
expect(ops.length).toBe(3);
|
|
36
|
-
ops.forEach((op, index) => {
|
|
37
|
-
expect(op).toHaveProperty("skip", index + 1);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe("mapSkippedOperations", () => {
|
|
42
|
-
it('should tag as "ignored" operation 2 when operation 3 -> (skip=1)', () => {
|
|
43
|
-
const operations = [
|
|
44
|
-
fakeOperation(1),
|
|
45
|
-
fakeOperation(2),
|
|
46
|
-
fakeOperation(3, 1),
|
|
47
|
-
];
|
|
48
|
-
const ignoredIndexes = [2];
|
|
49
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
50
|
-
expect(mappedOps.length).toBe(3);
|
|
51
|
-
mappedOps.forEach((mapOp) => {
|
|
52
|
-
let ignore = false;
|
|
53
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
54
|
-
ignore = true;
|
|
55
|
-
}
|
|
56
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
it('should tag as "ignored" operation 2, 3 and 4 when operation 5 -> (skip=3)', () => {
|
|
60
|
-
const operations = [
|
|
61
|
-
fakeOperation(1),
|
|
62
|
-
fakeOperation(2),
|
|
63
|
-
fakeOperation(3),
|
|
64
|
-
fakeOperation(4),
|
|
65
|
-
fakeOperation(5, 3),
|
|
66
|
-
];
|
|
67
|
-
const ignoredIndexes = [2, 3, 4];
|
|
68
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
69
|
-
expect(mappedOps.length).toBe(5);
|
|
70
|
-
mappedOps.forEach((mapOp) => {
|
|
71
|
-
let ignore = false;
|
|
72
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
73
|
-
ignore = true;
|
|
74
|
-
}
|
|
75
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
it('should tag as "ignored" operation 2 and 5 when opration 3 -> (skip=1) and operation 6 -> (skip=1)', () => {
|
|
79
|
-
const operations = [
|
|
80
|
-
fakeOperation(1),
|
|
81
|
-
fakeOperation(2),
|
|
82
|
-
fakeOperation(3, 1),
|
|
83
|
-
fakeOperation(4),
|
|
84
|
-
fakeOperation(5),
|
|
85
|
-
fakeOperation(6, 1),
|
|
86
|
-
];
|
|
87
|
-
const ignoredIndexes = [2, 5];
|
|
88
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
89
|
-
expect(mappedOps.length).toBe(6);
|
|
90
|
-
mappedOps.forEach((mapOp) => {
|
|
91
|
-
let ignore = false;
|
|
92
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
93
|
-
ignore = true;
|
|
94
|
-
}
|
|
95
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
it('should tag as "ignored" operation 1, 2, 3, 4, 5 and 6 when opration 7 -> (skip=6)', () => {
|
|
99
|
-
const operations = [
|
|
100
|
-
fakeOperation(1),
|
|
101
|
-
fakeOperation(2),
|
|
102
|
-
fakeOperation(3),
|
|
103
|
-
fakeOperation(4),
|
|
104
|
-
fakeOperation(5),
|
|
105
|
-
fakeOperation(6),
|
|
106
|
-
fakeOperation(7, 6),
|
|
107
|
-
];
|
|
108
|
-
const ignoredIndexes = [1, 2, 3, 4, 5, 6];
|
|
109
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
110
|
-
expect(mappedOps.length).toBe(7);
|
|
111
|
-
mappedOps.forEach((mapOp) => {
|
|
112
|
-
let ignore = false;
|
|
113
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
114
|
-
ignore = true;
|
|
115
|
-
}
|
|
116
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
it('should tag as "ignored" operation 2, 3, and 4 when operation 5 -> (skip=2) and operation 3 -> (skip=1)', () => {
|
|
120
|
-
const operations = [
|
|
121
|
-
fakeOperation(1),
|
|
122
|
-
fakeOperation(2),
|
|
123
|
-
fakeOperation(3, 1),
|
|
124
|
-
fakeOperation(4),
|
|
125
|
-
fakeOperation(5, 2),
|
|
126
|
-
];
|
|
127
|
-
const ignoredIndexes = [2, 3, 4];
|
|
128
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
129
|
-
expect(mappedOps.length).toBe(5);
|
|
130
|
-
mappedOps.forEach((mapOp) => {
|
|
131
|
-
let ignore = false;
|
|
132
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
133
|
-
ignore = true;
|
|
134
|
-
}
|
|
135
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
it('should tag as "ignored" operations 3, 4, 5, 6, and 7 when operation 6 -> (skip=1) and operation 8 -> (skip=5)', () => {
|
|
139
|
-
const operations = [
|
|
140
|
-
fakeOperation(1),
|
|
141
|
-
fakeOperation(2),
|
|
142
|
-
fakeOperation(3),
|
|
143
|
-
fakeOperation(4),
|
|
144
|
-
fakeOperation(5),
|
|
145
|
-
fakeOperation(6, 1),
|
|
146
|
-
fakeOperation(7),
|
|
147
|
-
fakeOperation(8, 5),
|
|
148
|
-
];
|
|
149
|
-
const ignoredIndexes = [3, 4, 5, 6, 7];
|
|
150
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
151
|
-
expect(mappedOps.length).toBe(8);
|
|
152
|
-
mappedOps.forEach((mapOp) => {
|
|
153
|
-
let ignore = false;
|
|
154
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
155
|
-
ignore = true;
|
|
156
|
-
}
|
|
157
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
it('should tag all the previous operations as "ignored" when operation 5 -> (skip=4)', () => {
|
|
161
|
-
const operations = [
|
|
162
|
-
fakeOperation(1),
|
|
163
|
-
fakeOperation(2),
|
|
164
|
-
fakeOperation(3),
|
|
165
|
-
fakeOperation(4),
|
|
166
|
-
fakeOperation(5, 4),
|
|
167
|
-
];
|
|
168
|
-
const ignoredIndexes = [1, 2, 3, 4];
|
|
169
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
170
|
-
expect(mappedOps.length).toBe(5);
|
|
171
|
-
mappedOps.forEach((mapOp) => {
|
|
172
|
-
let ignore = false;
|
|
173
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
174
|
-
ignore = true;
|
|
175
|
-
}
|
|
176
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
it("should not skip operations if there's not skipped operations and skippedHeadOperations is not provided", () => {
|
|
180
|
-
const operations = [fakeOperation(1), fakeOperation(2), fakeOperation(3)];
|
|
181
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
182
|
-
expect(mappedOps.length).toBe(3);
|
|
183
|
-
mappedOps.forEach((mapOp) => {
|
|
184
|
-
expect(mapOp).toHaveProperty("ignore", false);
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
it("should skip the latest operation when skippedHeadOperations = 1", () => {
|
|
188
|
-
const operations = [fakeOperation(1), fakeOperation(2), fakeOperation(3)];
|
|
189
|
-
const ignoredIndexes = [3];
|
|
190
|
-
const mappedOps = mapSkippedOperations(operations, 1);
|
|
191
|
-
expect(mappedOps.length).toBe(3);
|
|
192
|
-
mappedOps.forEach((mapOp) => {
|
|
193
|
-
let ignore = false;
|
|
194
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
195
|
-
ignore = true;
|
|
196
|
-
}
|
|
197
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
it("should skip the latest 2 operations when skippedHeadOperations = 2", () => {
|
|
201
|
-
const operations = [
|
|
202
|
-
fakeOperation(1),
|
|
203
|
-
fakeOperation(2),
|
|
204
|
-
fakeOperation(3),
|
|
205
|
-
fakeOperation(4),
|
|
206
|
-
fakeOperation(5),
|
|
207
|
-
];
|
|
208
|
-
const ignoredIndexes = [4, 5];
|
|
209
|
-
const mappedOps = mapSkippedOperations(operations, 2);
|
|
210
|
-
expect(mappedOps.length).toBe(5);
|
|
211
|
-
mappedOps.forEach((mapOp) => {
|
|
212
|
-
let ignore = false;
|
|
213
|
-
if (ignoredIndexes.includes(mapOp.operation.index)) {
|
|
214
|
-
ignore = true;
|
|
215
|
-
}
|
|
216
|
-
expect(mapOp).toHaveProperty("ignore", ignore);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
it("should be able to detect cleared operations", () => {
|
|
220
|
-
const operations = [
|
|
221
|
-
fakeOperation(0),
|
|
222
|
-
fakeOperation(1),
|
|
223
|
-
fakeOperation(3, 1),
|
|
224
|
-
];
|
|
225
|
-
const mappedOps = mapSkippedOperations(operations);
|
|
226
|
-
expect(mappedOps.length).toBe(3);
|
|
227
|
-
mappedOps.forEach((mapOp) => {
|
|
228
|
-
expect(mapOp).toHaveProperty("ignore", false);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
describe("replayOperations", () => {
|
|
233
|
-
it("should ignore operation 2, when operation 3 -> (skip=1)", () => {
|
|
234
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
235
|
-
let document = baseCreateDocument(createCountDocumentState, initialState);
|
|
236
|
-
document = countReducer(document, increment()); // valid operation, skip 0
|
|
237
|
-
document = countReducer(document, increment()); // skipped
|
|
238
|
-
document = countReducer(
|
|
239
|
-
// valid operation, skip 1
|
|
240
|
-
document, increment(), undefined, { skip: 1, ignoreSkipOperations: false });
|
|
241
|
-
const clearedOperations = garbageCollectDocumentOperations(document.operations);
|
|
242
|
-
const replayedDoc = replayOperations(initialState, clearedOperations, baseCountReducer, document.header);
|
|
243
|
-
expect(replayedDoc.header.revision.global).toBe(3);
|
|
244
|
-
expect(replayedDoc.operations.global.length).toBe(2);
|
|
245
|
-
expect(replayedDoc.operations.global).toMatchObject([
|
|
246
|
-
{
|
|
247
|
-
type: "INCREMENT",
|
|
248
|
-
skip: 0,
|
|
249
|
-
index: 0,
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
type: "INCREMENT",
|
|
253
|
-
skip: 1,
|
|
254
|
-
index: 2,
|
|
255
|
-
},
|
|
256
|
-
]);
|
|
257
|
-
});
|
|
258
|
-
it("should ignore operation 2, 3 and 4, when operation 5 -> (skip=3)", () => {
|
|
259
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
260
|
-
let document = baseCreateDocument(createCountDocumentState, initialState);
|
|
261
|
-
document = countReducer(document, increment()); // valid operation, skip 0
|
|
262
|
-
document = countReducer(document, increment()); // skipped
|
|
263
|
-
document = countReducer(document, increment()); // skipped
|
|
264
|
-
document = countReducer(document, increment()); // skipped
|
|
265
|
-
document = countReducer(
|
|
266
|
-
// valid operation, skip 3
|
|
267
|
-
document, increment(), undefined, { skip: 3, ignoreSkipOperations: true });
|
|
268
|
-
const clearedOperations = garbageCollectDocumentOperations(document.operations);
|
|
269
|
-
const replayedDoc = replayOperations(initialState, clearedOperations, baseCountReducer, document.header);
|
|
270
|
-
expect(replayedDoc.header.revision.global).toBe(5);
|
|
271
|
-
expect(replayedDoc.operations.global.length).toBe(2);
|
|
272
|
-
expect(replayedDoc.operations.global).toMatchObject([
|
|
273
|
-
{
|
|
274
|
-
type: "INCREMENT",
|
|
275
|
-
skip: 0,
|
|
276
|
-
index: 0,
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
type: "INCREMENT",
|
|
280
|
-
skip: 3,
|
|
281
|
-
index: 4,
|
|
282
|
-
},
|
|
283
|
-
]);
|
|
284
|
-
});
|
|
285
|
-
it("should ignore operation 2 and 5, when operation 3 -> (skip=1) and operation 6 -> (skip=1)", () => {
|
|
286
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
287
|
-
let document = baseCreateDocument(createCountDocumentState, initialState);
|
|
288
|
-
document = countReducer(document, increment()); // valid operation, skip 0
|
|
289
|
-
document = countReducer(document, increment()); // skipped
|
|
290
|
-
document = countReducer(
|
|
291
|
-
// valid operation, skip 1
|
|
292
|
-
document, increment(), undefined, { skip: 1, ignoreSkipOperations: true });
|
|
293
|
-
document = countReducer(document, increment()); // valid operation, skip 0
|
|
294
|
-
document = countReducer(document, increment()); // skipped
|
|
295
|
-
document = countReducer(
|
|
296
|
-
// valid operation, skip 1
|
|
297
|
-
document, increment(), undefined, { skip: 1, ignoreSkipOperations: true });
|
|
298
|
-
const clearedOperations = garbageCollectDocumentOperations(document.operations);
|
|
299
|
-
const replayedDoc = replayOperations(initialState, clearedOperations, baseCountReducer, document.header);
|
|
300
|
-
expect(replayedDoc.header.revision.global).toBe(6);
|
|
301
|
-
expect(replayedDoc.operations.global.length).toBe(4);
|
|
302
|
-
expect(replayedDoc.operations.global).toMatchObject([
|
|
303
|
-
{
|
|
304
|
-
type: "INCREMENT",
|
|
305
|
-
skip: 0,
|
|
306
|
-
index: 0,
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
type: "INCREMENT",
|
|
310
|
-
skip: 1,
|
|
311
|
-
index: 2,
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
type: "INCREMENT",
|
|
315
|
-
skip: 0,
|
|
316
|
-
index: 3,
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
type: "INCREMENT",
|
|
320
|
-
skip: 1,
|
|
321
|
-
index: 5,
|
|
322
|
-
},
|
|
323
|
-
]);
|
|
324
|
-
});
|
|
325
|
-
it("should ignore all the previous operations, when operation 5 -> (skip=4)", () => {
|
|
326
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
327
|
-
let document = baseCreateDocument(createCountDocumentState, initialState);
|
|
328
|
-
document = countReducer(document, increment()); // skipped
|
|
329
|
-
document = countReducer(document, increment()); // skipped
|
|
330
|
-
document = countReducer(document, increment()); // skipped
|
|
331
|
-
document = countReducer(document, increment()); // skipped
|
|
332
|
-
document = countReducer(
|
|
333
|
-
// valid operation, skip 4
|
|
334
|
-
document, increment(), undefined, { skip: 4, ignoreSkipOperations: true });
|
|
335
|
-
const clearedOperations = garbageCollectDocumentOperations(document.operations);
|
|
336
|
-
const replayedDoc = replayOperations(initialState, clearedOperations, baseCountReducer, document.header);
|
|
337
|
-
expect(replayedDoc.header.revision.global).toBe(5);
|
|
338
|
-
expect(replayedDoc.operations.global.length).toBe(1);
|
|
339
|
-
expect(replayedDoc.operations.global).toMatchObject([
|
|
340
|
-
{
|
|
341
|
-
type: "INCREMENT",
|
|
342
|
-
skip: 4,
|
|
343
|
-
index: 4,
|
|
344
|
-
},
|
|
345
|
-
]);
|
|
346
|
-
});
|
|
347
|
-
it("should skip operations when dispatch a new action with an skip value", () => {
|
|
348
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
349
|
-
let document = baseCreateDocument(createCountDocumentState, initialState);
|
|
350
|
-
document = countReducer(document, increment());
|
|
351
|
-
document = countReducer(document, increment());
|
|
352
|
-
document = countReducer(document, increment(), undefined, {
|
|
353
|
-
skip: 1,
|
|
354
|
-
});
|
|
355
|
-
document = countReducer(document, increment());
|
|
356
|
-
document = countReducer(document, increment(), undefined, {
|
|
357
|
-
skip: 1,
|
|
358
|
-
});
|
|
359
|
-
expect(document.state.global.count).toBe(3);
|
|
360
|
-
expect(document.operations.global.length).toBe(3);
|
|
361
|
-
expect(document.operations.global).toMatchObject([
|
|
362
|
-
{
|
|
363
|
-
type: "INCREMENT",
|
|
364
|
-
skip: 0,
|
|
365
|
-
index: 0,
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
type: "INCREMENT",
|
|
369
|
-
skip: 1,
|
|
370
|
-
index: 2,
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
type: "INCREMENT",
|
|
374
|
-
skip: 1,
|
|
375
|
-
index: 4,
|
|
376
|
-
},
|
|
377
|
-
]);
|
|
378
|
-
});
|
|
379
|
-
it("should not process and skip operation that throws an error", () => {
|
|
380
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
381
|
-
let document = baseCreateDocument(createCountDocumentState, initialState);
|
|
382
|
-
document = countReducer(document, increment());
|
|
383
|
-
document = countReducer(document, increment());
|
|
384
|
-
document = countReducer(document, error(), undefined, {
|
|
385
|
-
skip: 1,
|
|
386
|
-
});
|
|
387
|
-
expect(document.state.global.count).toBe(2);
|
|
388
|
-
expect(document.operations.global.length).toBe(3);
|
|
389
|
-
expect(document.operations.global).toMatchObject([
|
|
390
|
-
{
|
|
391
|
-
type: "INCREMENT",
|
|
392
|
-
skip: 0,
|
|
393
|
-
index: 0,
|
|
394
|
-
error: undefined,
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
type: "INCREMENT",
|
|
398
|
-
skip: 0,
|
|
399
|
-
index: 1,
|
|
400
|
-
error: undefined,
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
type: "ERROR",
|
|
404
|
-
skip: 0,
|
|
405
|
-
index: 2,
|
|
406
|
-
error: "Error action",
|
|
407
|
-
},
|
|
408
|
-
]);
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
//# sourceMappingURL=skip-operations.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skip-operations.test.js","sourceRoot":"","sources":["../../../test/document/skip-operations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAChC,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,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AK,EAAE,cAAc;iBACtB;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undo-redo-v2.test.d.ts","sourceRoot":"","sources":["../../../test/document/undo-redo-v2.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { baseCreateDocument, processUndoRedo, undo } from "document-model/core";
|
|
2
|
-
import { countReducer, createCountDocumentState, increment, testCreateBaseState, } from "document-model/test";
|
|
3
|
-
import { beforeEach, describe, expect, it } from "vitest";
|
|
4
|
-
describe("UNDO/REDO with protocolVersion: 2", () => {
|
|
5
|
-
let document;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
const initialState = testCreateBaseState({ count: 0 }, { name: "" });
|
|
8
|
-
document = baseCreateDocument(createCountDocumentState, initialState);
|
|
9
|
-
document = countReducer(document, increment());
|
|
10
|
-
document = countReducer(document, increment());
|
|
11
|
-
document = countReducer(document, increment());
|
|
12
|
-
});
|
|
13
|
-
describe("processUndoRedo with protocolVersion: 2", () => {
|
|
14
|
-
it("should return reuseLastOperationIndex: false", () => {
|
|
15
|
-
const undoAction = undo();
|
|
16
|
-
const result = processUndoRedo(document, undoAction, 0, 2);
|
|
17
|
-
expect(result.reuseLastOperationIndex).toBe(false);
|
|
18
|
-
});
|
|
19
|
-
it("should always return skip=1 for v2", () => {
|
|
20
|
-
const undoAction = undo();
|
|
21
|
-
const result = processUndoRedo(document, undoAction, 0, 2);
|
|
22
|
-
expect(result.skip).toBe(1);
|
|
23
|
-
expect(result.action.type).toBe("NOOP");
|
|
24
|
-
});
|
|
25
|
-
it("should always return reuseLastOperationIndex: false even after NOOP", () => {
|
|
26
|
-
document = countReducer(document, undo());
|
|
27
|
-
const undoAction = undo();
|
|
28
|
-
const result = processUndoRedo(document, undoAction, 0, 2);
|
|
29
|
-
expect(result.reuseLastOperationIndex).toBe(false);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
describe("comparison: protocolVersion 1 vs 2", () => {
|
|
33
|
-
it("protocolVersion 1 allows index reuse after NOOP", () => {
|
|
34
|
-
document = countReducer(document, undo());
|
|
35
|
-
const undoAction = undo();
|
|
36
|
-
const resultV1 = processUndoRedo(document, undoAction, 0, 1);
|
|
37
|
-
expect(resultV1.reuseLastOperationIndex).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
it("protocolVersion 2 never allows index reuse", () => {
|
|
40
|
-
document = countReducer(document, undo());
|
|
41
|
-
const undoAction = undo();
|
|
42
|
-
const resultV2 = processUndoRedo(document, undoAction, 0, 2);
|
|
43
|
-
expect(resultV2.reuseLastOperationIndex).toBe(false);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
describe("end-to-end with protocolVersion: 2 in reducer", () => {
|
|
47
|
-
it("should create NOOP operations with correct skip value", () => {
|
|
48
|
-
document = countReducer(document, undo(), undefined, {
|
|
49
|
-
protocolVersion: 2,
|
|
50
|
-
});
|
|
51
|
-
const ops = document.operations.global;
|
|
52
|
-
const lastOp = ops[ops.length - 1];
|
|
53
|
-
expect(lastOp.action.type).toBe("NOOP");
|
|
54
|
-
expect(lastOp.skip).toBe(1);
|
|
55
|
-
expect(lastOp.index).toBe(3);
|
|
56
|
-
});
|
|
57
|
-
it("protocolVersion 2 always creates NOOPs with skip=1", () => {
|
|
58
|
-
document = countReducer(document, undo(), undefined, {
|
|
59
|
-
protocolVersion: 2,
|
|
60
|
-
});
|
|
61
|
-
const ops = document.operations.global;
|
|
62
|
-
const noopOp = ops.find((op) => op.action.type === "NOOP");
|
|
63
|
-
expect(noopOp).toBeDefined();
|
|
64
|
-
expect(noopOp.skip).toBe(1);
|
|
65
|
-
});
|
|
66
|
-
it("should correctly undo state with protocolVersion 2", () => {
|
|
67
|
-
expect(document.state.global.count).toBe(3);
|
|
68
|
-
document = countReducer(document, undo(), undefined, {
|
|
69
|
-
protocolVersion: 2,
|
|
70
|
-
});
|
|
71
|
-
expect(document.state.global.count).toBe(2);
|
|
72
|
-
});
|
|
73
|
-
it("consecutive undos should all have skip=1 and incrementing indices", () => {
|
|
74
|
-
// First undo
|
|
75
|
-
document = countReducer(document, undo(), undefined, {
|
|
76
|
-
protocolVersion: 2,
|
|
77
|
-
});
|
|
78
|
-
const ops1 = document.operations.global;
|
|
79
|
-
const noop1 = ops1[ops1.length - 1];
|
|
80
|
-
expect(noop1.action.type).toBe("NOOP");
|
|
81
|
-
expect(noop1.skip).toBe(1);
|
|
82
|
-
expect(noop1.index).toBe(3);
|
|
83
|
-
expect(document.state.global.count).toBe(2);
|
|
84
|
-
// Second undo
|
|
85
|
-
document = countReducer(document, undo(), undefined, {
|
|
86
|
-
protocolVersion: 2,
|
|
87
|
-
});
|
|
88
|
-
const ops2 = document.operations.global;
|
|
89
|
-
const noop2 = ops2[ops2.length - 1];
|
|
90
|
-
expect(noop2.action.type).toBe("NOOP");
|
|
91
|
-
expect(noop2.skip).toBe(1);
|
|
92
|
-
expect(noop2.index).toBe(4); // Should increment, not reuse
|
|
93
|
-
expect(document.state.global.count).toBe(1);
|
|
94
|
-
// Third undo
|
|
95
|
-
document = countReducer(document, undo(), undefined, {
|
|
96
|
-
protocolVersion: 2,
|
|
97
|
-
});
|
|
98
|
-
const ops3 = document.operations.global;
|
|
99
|
-
const noop3 = ops3[ops3.length - 1];
|
|
100
|
-
expect(noop3.action.type).toBe("NOOP");
|
|
101
|
-
expect(noop3.skip).toBe(1);
|
|
102
|
-
expect(noop3.index).toBe(5); // Should increment, not reuse
|
|
103
|
-
expect(document.state.global.count).toBe(0);
|
|
104
|
-
});
|
|
105
|
-
it("should throw when trying to undo more than available", () => {
|
|
106
|
-
// Undo all 3 increments
|
|
107
|
-
document = countReducer(document, undo(), undefined, {
|
|
108
|
-
protocolVersion: 2,
|
|
109
|
-
});
|
|
110
|
-
document = countReducer(document, undo(), undefined, {
|
|
111
|
-
protocolVersion: 2,
|
|
112
|
-
});
|
|
113
|
-
document = countReducer(document, undo(), undefined, {
|
|
114
|
-
protocolVersion: 2,
|
|
115
|
-
});
|
|
116
|
-
expect(document.state.global.count).toBe(0);
|
|
117
|
-
// Try to undo when there's nothing left
|
|
118
|
-
expect(() => countReducer(document, undo(), undefined, {
|
|
119
|
-
protocolVersion: 2,
|
|
120
|
-
})).toThrow("Cannot undo: no more operations to undo in scope history");
|
|
121
|
-
});
|
|
122
|
-
it("operations list should preserve all operations including NOOPs", () => {
|
|
123
|
-
document = countReducer(document, undo(), undefined, {
|
|
124
|
-
protocolVersion: 2,
|
|
125
|
-
});
|
|
126
|
-
document = countReducer(document, undo(), undefined, {
|
|
127
|
-
protocolVersion: 2,
|
|
128
|
-
});
|
|
129
|
-
const ops = document.operations.global;
|
|
130
|
-
// Should have: 3 increments + 2 NOOPs = 5 operations
|
|
131
|
-
expect(ops.length).toBe(5);
|
|
132
|
-
expect(ops.map((op) => op.action.type)).toEqual([
|
|
133
|
-
"INCREMENT",
|
|
134
|
-
"INCREMENT",
|
|
135
|
-
"INCREMENT",
|
|
136
|
-
"NOOP",
|
|
137
|
-
"NOOP",
|
|
138
|
-
]);
|
|
139
|
-
expect(ops.map((op) => op.index)).toEqual([0, 1, 2, 3, 4]);
|
|
140
|
-
});
|
|
141
|
-
it("should handle undo after new operations added following undos (gapped indices)", () => {
|
|
142
|
-
// This test reproduces the bug where undo fails after:
|
|
143
|
-
// 1. Multiple undos create NOOPs
|
|
144
|
-
// 2. New operations are added after the undos
|
|
145
|
-
// 3. Undo is triggered again
|
|
146
|
-
//
|
|
147
|
-
// The issue is that garbageCollectV2 creates a set of effective operations
|
|
148
|
-
// with gaps in indices (e.g., [0, 5, 6] instead of [0, 1, 2, 3, 4, 5, 6])
|
|
149
|
-
// and the state rebuild fails due to index validation.
|
|
150
|
-
// Initial state: count = 3 with operations [0: INC, 1: INC, 2: INC]
|
|
151
|
-
expect(document.state.global.count).toBe(3);
|
|
152
|
-
// Undo twice: count = 1
|
|
153
|
-
// Operations: [0: INC, 1: INC, 2: INC, 3: NOOP(skip=1), 4: NOOP(skip=1)]
|
|
154
|
-
document = countReducer(document, undo(), undefined, {
|
|
155
|
-
protocolVersion: 2,
|
|
156
|
-
});
|
|
157
|
-
document = countReducer(document, undo(), undefined, {
|
|
158
|
-
protocolVersion: 2,
|
|
159
|
-
});
|
|
160
|
-
expect(document.state.global.count).toBe(1);
|
|
161
|
-
// Add new operations after undos: count = 3
|
|
162
|
-
// Operations: [0: INC, 1: INC, 2: INC, 3: NOOP, 4: NOOP, 5: INC, 6: INC]
|
|
163
|
-
document = countReducer(document, increment(), undefined, {
|
|
164
|
-
protocolVersion: 2,
|
|
165
|
-
});
|
|
166
|
-
document = countReducer(document, increment(), undefined, {
|
|
167
|
-
protocolVersion: 2,
|
|
168
|
-
});
|
|
169
|
-
expect(document.state.global.count).toBe(3);
|
|
170
|
-
const opsBeforeUndo = document.operations.global;
|
|
171
|
-
expect(opsBeforeUndo.map((op) => op.action.type)).toEqual([
|
|
172
|
-
"INCREMENT",
|
|
173
|
-
"INCREMENT",
|
|
174
|
-
"INCREMENT",
|
|
175
|
-
"NOOP",
|
|
176
|
-
"NOOP",
|
|
177
|
-
"INCREMENT",
|
|
178
|
-
"INCREMENT",
|
|
179
|
-
]);
|
|
180
|
-
expect(opsBeforeUndo.map((op) => op.index)).toEqual([
|
|
181
|
-
0, 1, 2, 3, 4, 5, 6,
|
|
182
|
-
]);
|
|
183
|
-
// Now undo - this is where the bug occurs
|
|
184
|
-
// garbageCollectV2 will return effective operations with gapped indices
|
|
185
|
-
// (operations 1, 2 are "undone" by NOOPs at 3, 4)
|
|
186
|
-
// Effective non-NOOP ops: indices [0, 5, 6] - there's a gap!
|
|
187
|
-
document = countReducer(document, undo(), undefined, {
|
|
188
|
-
protocolVersion: 2,
|
|
189
|
-
});
|
|
190
|
-
// Should have undone the last increment
|
|
191
|
-
expect(document.state.global.count).toBe(2);
|
|
192
|
-
const opsAfterUndo = document.operations.global;
|
|
193
|
-
expect(opsAfterUndo.length).toBe(8);
|
|
194
|
-
expect(opsAfterUndo.map((op) => op.action.type)).toEqual([
|
|
195
|
-
"INCREMENT",
|
|
196
|
-
"INCREMENT",
|
|
197
|
-
"INCREMENT",
|
|
198
|
-
"NOOP",
|
|
199
|
-
"NOOP",
|
|
200
|
-
"INCREMENT",
|
|
201
|
-
"INCREMENT",
|
|
202
|
-
"NOOP",
|
|
203
|
-
]);
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
//# sourceMappingURL=undo-redo-v2.test.js.map
|