@@ -4,20 +4,36 @@ import { FlowCanvas } from '../../../components/flow/FlowCanvas';
44import { apiService } from '../../../services/api' ;
55
66jest . mock ( 'reactflow' , ( ) => {
7- const actual = jest . requireActual ( 'reactflow' ) ;
7+ const MockReactFlow = ( { children } : any ) => (
8+ < div data-testid = "react-flow" > { children } </ div >
9+ ) ;
810 return {
9- ...actual ,
10- default : jest . fn ( ( { children } : any ) => (
11- < div data-testid = "react-flow" > { children } </ div >
12- ) ) ,
11+ __esModule : true ,
12+ default : MockReactFlow ,
13+ ReactFlow : MockReactFlow ,
1314 MiniMap : ( ) => < div data-testid = "minimap" /> ,
1415 Background : ( ) => < div data-testid = "background" /> ,
16+ Controls : ( ) => < div data-testid = "controls" /> ,
17+ Handle : ( { children } : any ) => < div > { children } </ div > ,
18+ Position : { Left : 'left' , Right : 'right' , Top : 'top' , Bottom : 'bottom' } ,
19+ MarkerType : { ArrowClosed : 'arrowclosed' , Arrow : 'arrow' } ,
20+ ConnectionMode : { Loose : 'loose' , Strict : 'strict' } ,
1521 useReactFlow : ( ) => ( {
1622 screenToFlowPosition : jest . fn ( ( ) => ( { x : 100 , y : 100 } ) ) ,
1723 getNodes : jest . fn ( ( ) => [ ] ) ,
1824 getEdges : jest . fn ( ( ) => [ ] ) ,
1925 fitView : jest . fn ( ) ,
26+ project : jest . fn ( ( pos : any ) => pos ) ,
2027 } ) ,
28+ useNodes : jest . fn ( ( ) => [ ] ) ,
29+ useEdges : jest . fn ( ( ) => [ ] ) ,
30+ useStore : jest . fn ( ( ) => ( { } ) ) ,
31+ applyNodeChanges : jest . fn ( ( changes : any , nodes : any ) => nodes ) ,
32+ applyEdgeChanges : jest . fn ( ( changes : any , edges : any ) => edges ) ,
33+ addEdge : jest . fn ( ( edge : any , edges : any ) => [ ...edges , edge ] ) ,
34+ getBezierPath : jest . fn ( ( ) => [ 'M0,0' , 0 , 0 , 0 , 0 ] ) ,
35+ getStraightPath : jest . fn ( ( ) => [ 'M0,0' , 0 , 0 ] ) ,
36+ getSimpleBezierPath : jest . fn ( ( ) => [ 'M0,0' , 0 , 0 , 0 , 0 ] ) ,
2137 } ;
2238} ) ;
2339
@@ -363,7 +379,7 @@ describe('isDeleteKey logic', () => {
363379
364380describe ( 'isEditableElement logic' , ( ) => {
365381 const isEditable = ( el : Element ) =>
366- el . tagName === 'INPUT' || el . tagName === 'TEXTAREA' || ( el as HTMLElement ) . isContentEditable ;
382+ el . tagName === 'INPUT' || el . tagName === 'TEXTAREA' || ( el as HTMLElement ) . isContentEditable === true ;
367383
368384 it ( 'true for input' , ( ) => expect ( isEditable ( document . createElement ( 'input' ) ) ) . toBe ( true ) ) ;
369385 it ( 'true for textarea' , ( ) => expect ( isEditable ( document . createElement ( 'textarea' ) ) ) . toBe ( true ) ) ;
0 commit comments