20 lines
722 B
TypeScript
20 lines
722 B
TypeScript
import { mockReactFlow } from '../../../../setupFlowTests.ts';
|
|
import {act} from "@testing-library/react";
|
|
import useFlowStore from "../../../../../src/pages/VisProgPage/visualProgrammingUI/VisProgStores.tsx";
|
|
import {addNode} from "../../../../../src/pages/VisProgPage/visualProgrammingUI/components/DragDropSidebar.tsx";
|
|
|
|
|
|
beforeAll(() => {
|
|
mockReactFlow();
|
|
});
|
|
|
|
describe('Drag-and-Drop sidebar', () => {
|
|
test.each(['phase', 'phase'])('new nodes get added correctly', (nodeType: string) => {
|
|
act(()=> {
|
|
addNode(nodeType, {x:100, y:100});
|
|
})
|
|
const updatedState = useFlowStore.getState();
|
|
expect(updatedState.nodes.length).toBe(1);
|
|
expect(updatedState.nodes[0].type).toBe(nodeType);
|
|
});
|
|
}); |