feat: added ReactFlow-based node graph #11

Merged
j.gerla merged 68 commits from feat/visual-programming-interface into dev 2025-10-28 11:59:03 +00:00
Showing only changes of commit c8484d28e5 - Show all commits

View File

@@ -81,6 +81,49 @@ describe('FlowStore Functionality', () => {
}); });
}); });
describe('ReactFlow onReconnectEnd', () => { describe('ReactFlow onReconnectEnd', () => {
// prepares the state to have an edge in the edge array
beforeEach(() => {
useFlowStore.setState({edges: [
{
id: 'xy-edge__A-B',
source: 'A',
target: 'B'
}
]}
);
});
test('successfully removes edge if no successful reconnect occurred', () => {
const {onReconnectEnd} = useFlowStore.getState();
useFlowStore.setState({edgeReconnectSuccessful: false});
act(() => {
onReconnectEnd(null, {id: 'xy-edge__A-B'});
});
const updatedState = useFlowStore.getState();
expect(updatedState.edgeReconnectSuccessful).toBe(true);
expect(updatedState.edges).toHaveLength(0);
});
test('does not remove reconnecting edge if successful reconnect occurred', () => {
const {onReconnectEnd} = useFlowStore.getState();
act(() => {
onReconnectEnd(null, {id: 'xy-edge__A-B'});
});
const updatedState = useFlowStore.getState();
expect(updatedState.edgeReconnectSuccessful).toBe(true);
expect(updatedState.edges).toHaveLength(1);
expect(updatedState.edges).toMatchObject([
{
id: 'xy-edge__A-B',
source: 'A',
target: 'B'
}]
);
});
}); });
describe('ReactFlow setNodes', () => { describe('ReactFlow setNodes', () => {
test('sets nodes to the provided list of nodes', () => { test('sets nodes to the provided list of nodes', () => {