test: added tests for the ProgramStore

also added documentation

ref: N25B-428
This commit is contained in:
JGerla
2025-12-20 22:58:22 +01:00
parent faaf67138d
commit b10dbae488
4 changed files with 191 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import {
import '@xyflow/react/dist/style.css';
import {useEffect} from "react";
import {useShallow} from 'zustand/react/shallow';
import useProgramStore from "../../utils/programStore.ts";
import {DndToolbar} from './visualProgrammingUI/components/DragDropSidebar.tsx';
import useFlowStore from './visualProgrammingUI/VisProgStores.tsx';
import type {FlowState} from './visualProgrammingUI/VisProgTypes.tsx';
@@ -152,6 +153,10 @@ function runProgram() {
).then((res) => {
if (!res.ok) throw new Error("Failed communicating with the backend.")
console.log("Successfully sent the program to the backend.");
// store reduced program in global program store for further use in the UI
// when the program was sent to the backend successfully:
useProgramStore.getState().setProgramState(structuredClone(program));
}).catch(() => console.log("Failed to send program to the backend."));
}