Persist circuit cell edits
This commit is contained in:
@@ -2,6 +2,8 @@ import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import {
|
||||
allColumns,
|
||||
buildCircuitEditPatch,
|
||||
buildDeviceRowEditPatch,
|
||||
getBlockSortValue,
|
||||
getCellKind,
|
||||
getCircuitValue,
|
||||
@@ -85,4 +87,38 @@ describe("circuit grid model", () => {
|
||||
assert.equal(parseNumeric("quantity", ""), undefined);
|
||||
assert.throws(() => parseNumeric("quantity", "two"), /Ungültiger Zahlenwert/);
|
||||
});
|
||||
|
||||
it("builds nullable circuit command patches from grid drafts", () => {
|
||||
assert.deepEqual(buildCircuitEditPatch("voltage", ""), {
|
||||
voltage: null,
|
||||
});
|
||||
assert.deepEqual(
|
||||
buildCircuitEditPatch("controlRequirement", " DALI "),
|
||||
{ controlRequirement: "DALI" }
|
||||
);
|
||||
assert.deepEqual(buildCircuitEditPatch("isReserve", "ja"), {
|
||||
isReserve: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("builds device command patches with explicit clearing semantics", () => {
|
||||
assert.deepEqual(buildDeviceRowEditPatch("roomSummary", ""), {
|
||||
roomNumberSnapshot: null,
|
||||
roomNameSnapshot: null,
|
||||
});
|
||||
assert.deepEqual(
|
||||
buildDeviceRowEditPatch("roomSummary", "1.01 Büro"),
|
||||
{
|
||||
roomNumberSnapshot: "1.01",
|
||||
roomNameSnapshot: "Büro",
|
||||
}
|
||||
);
|
||||
assert.deepEqual(buildDeviceRowEditPatch("technicalName", " Leuchte "), {
|
||||
name: "Leuchte",
|
||||
});
|
||||
assert.throws(
|
||||
() => buildDeviceRowEditPatch("quantity", ""),
|
||||
/darf nicht leer sein/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user