Merging dev into main #49
@@ -1,30 +0,0 @@
|
||||
import { act } from '@testing-library/react';
|
||||
import useFlowStore from '../../../src/pages/VisProgPage/visualProgrammingUI/VisProgStores.tsx';
|
||||
import { mockReactFlow } from '../../setupFlowTests.ts';
|
||||
|
||||
beforeAll(() => {
|
||||
mockReactFlow();
|
||||
});
|
||||
|
||||
describe('FlowCanvas onConnect', () => {
|
||||
|
||||
test('adds an edge when onConnect is triggered', () => {
|
||||
const { onConnect} = useFlowStore.getState();
|
||||
|
||||
act(() => {
|
||||
onConnect({
|
||||
source: 'A',
|
||||
target: 'B',
|
||||
sourceHandle: null,
|
||||
targetHandle: null,
|
||||
});
|
||||
});
|
||||
|
||||
const updatedEdges = useFlowStore.getState().edges;
|
||||
expect(updatedEdges).toHaveLength(1);
|
||||
expect(updatedEdges[0]).toMatchObject({
|
||||
source: 'A',
|
||||
target: 'B',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import { act } from '@testing-library/react';
|
||||
import useFlowStore from '../../../../src/pages/VisProgPage/visualProgrammingUI/VisProgStores.tsx';
|
||||
import { mockReactFlow } from '../../../setupFlowTests.ts';
|
||||
|
||||
beforeAll(() => {
|
||||
mockReactFlow();
|
||||
});
|
||||
|
||||
describe('FlowStore Functionality', () => {
|
||||
describe('ReactFlow onConnect', () => {
|
||||
test('adds an edge when onConnect is triggered', () => {
|
||||
const { onConnect} = useFlowStore.getState();
|
||||
|
||||
act(() => {
|
||||
onConnect({
|
||||
source: 'A',
|
||||
target: 'B',
|
||||
sourceHandle: null,
|
||||
targetHandle: null,
|
||||
});
|
||||
});
|
||||
|
||||
const updatedEdges = useFlowStore.getState().edges;
|
||||
expect(updatedEdges).toHaveLength(1);
|
||||
expect(updatedEdges[0]).toMatchObject({
|
||||
source: 'A',
|
||||
target: 'B',
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user