Add section renumber history
This commit is contained in:
@@ -33,6 +33,10 @@ import {
|
||||
assertCircuitSectionReorderProjectCommand,
|
||||
createCircuitSectionReorderProjectCommand,
|
||||
} from "../src/domain/models/circuit-section-reorder-project-command.model.js";
|
||||
import {
|
||||
assertCircuitSectionRenumberProjectCommand,
|
||||
createCircuitSectionRenumberProjectCommand,
|
||||
} from "../src/domain/models/circuit-section-renumber-project-command.model.js";
|
||||
|
||||
describe("serialized project commands", () => {
|
||||
it("round-trips a versioned command envelope", () => {
|
||||
@@ -581,3 +585,57 @@ describe("circuit section reorder project commands", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("circuit section renumber project commands", () => {
|
||||
it("captures every expected and target equipment identifier", () => {
|
||||
const command = createCircuitSectionRenumberProjectCommand(
|
||||
"section-1",
|
||||
[
|
||||
{
|
||||
circuitId: "circuit-1",
|
||||
expectedEquipmentIdentifier: "-1F1",
|
||||
targetEquipmentIdentifier: "-1F2",
|
||||
},
|
||||
{
|
||||
circuitId: "circuit-2",
|
||||
expectedEquipmentIdentifier: "-1F2",
|
||||
targetEquipmentIdentifier: "-1F1",
|
||||
},
|
||||
]
|
||||
);
|
||||
assert.equal(command.payload.assignments.length, 2);
|
||||
assert.doesNotThrow(() =>
|
||||
assertCircuitSectionRenumberProjectCommand(command)
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects duplicate and complete no-op assignments", () => {
|
||||
assert.throws(
|
||||
() =>
|
||||
createCircuitSectionRenumberProjectCommand("section-1", [
|
||||
{
|
||||
circuitId: "circuit-1",
|
||||
expectedEquipmentIdentifier: "-1F1",
|
||||
targetEquipmentIdentifier: "-1F2",
|
||||
},
|
||||
{
|
||||
circuitId: "circuit-2",
|
||||
expectedEquipmentIdentifier: "-1F2",
|
||||
targetEquipmentIdentifier: "-1F2",
|
||||
},
|
||||
]),
|
||||
/duplicate target identifiers/
|
||||
);
|
||||
assert.throws(
|
||||
() =>
|
||||
createCircuitSectionRenumberProjectCommand("section-1", [
|
||||
{
|
||||
circuitId: "circuit-1",
|
||||
expectedEquipmentIdentifier: "-1F1",
|
||||
targetEquipmentIdentifier: "-1F1",
|
||||
},
|
||||
]),
|
||||
/change at least one identifier/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user