forked from jappel/leistungsbilanz-ts
Configure circuit protection
This commit is contained in:
parent
18ca5eb3d4
commit
8898117ed4
18 changed files with 642 additions and 14 deletions
|
|
@ -66,17 +66,20 @@ export function assertCircuitProtectionUpdateProjectCommand(
|
|||
throw new Error("Circuit protection update must change state.");
|
||||
}
|
||||
if (expected !== null) {
|
||||
assertSnapshot(expected, circuitId);
|
||||
assertCircuitProtectionSnapshot(expected, circuitId);
|
||||
}
|
||||
if (target !== null) {
|
||||
assertSnapshot(target, circuitId);
|
||||
assertCircuitProtectionSnapshot(target, circuitId);
|
||||
}
|
||||
if (JSON.stringify(expected) === JSON.stringify(target)) {
|
||||
throw new Error("Circuit protection update must change state.");
|
||||
}
|
||||
}
|
||||
|
||||
function assertSnapshot(value: unknown, circuitId: string) {
|
||||
export function assertCircuitProtectionSnapshot(
|
||||
value: unknown,
|
||||
circuitId: string
|
||||
) {
|
||||
if (
|
||||
!isPlainObject(value) ||
|
||||
Object.keys(value).length !== 7 ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue