fix(api): align frontend with REST contracts
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
createSchemeEditorState,
|
||||
deleteSensorPoint,
|
||||
isSchemeDirty,
|
||||
redoSchemeEdit,
|
||||
replaceSensorPoint,
|
||||
resetSchemeEdit,
|
||||
summarizeChanges,
|
||||
@@ -44,6 +45,24 @@ describe("scheme editor", () => {
|
||||
expect(undoSchemeEdit(added).points).toEqual(initial.points);
|
||||
});
|
||||
|
||||
it("can redo an undone edit and clears redo history after a new edit", () => {
|
||||
const initial = createSchemeEditorState(scheme);
|
||||
const added = addSensorPoint(initial, point("J3"));
|
||||
const undone = undoSchemeEdit(added);
|
||||
const redone = redoSchemeEdit(undone);
|
||||
|
||||
expect(redone.points.map((item) => item.node_id)).toEqual([
|
||||
"J1",
|
||||
"J2",
|
||||
"J3",
|
||||
]);
|
||||
expect(redone.history).toHaveLength(1);
|
||||
expect(redone.future).toEqual([]);
|
||||
|
||||
const editedAfterUndo = replaceSensorPoint(undone, "J1", point("J4"));
|
||||
expect(editedAfterUndo.future).toEqual([]);
|
||||
});
|
||||
|
||||
it("replaces a node without changing row order", () => {
|
||||
const initial = createSchemeEditorState(scheme);
|
||||
const replaced = replaceSensorPoint(initial, "J1", point("J3"));
|
||||
@@ -80,5 +99,6 @@ describe("scheme editor", () => {
|
||||
expect(reset.points.map((item) => item.node_id)).toEqual(["J1", "J2"]);
|
||||
expect(isSchemeDirty(reset)).toBe(false);
|
||||
expect(reset.history).toEqual([]);
|
||||
expect(reset.future).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user