11const mockDiagramming = {
22 // Keep original exports by spreading them (if needed)
3+ // eslint-disable-next-line @typescript-eslint/no-require-imports
34 ...require ( '@mongodb-js/diagramming' ) ,
45
56 // Override Diagram import because it's causing esm/cjs interop issues
6- Diagram : ( props ) => (
7+ Diagram : ( props : any ) => (
78 < div data-testid = "mock-diagram" >
89 { Object . entries ( props ) . map ( ( [ key , value ] ) => (
910 < div key = { key } data-testid = { `diagram-prop-${ key } ` } >
@@ -12,9 +13,9 @@ const mockDiagramming = {
1213 ) ) }
1314 </ div >
1415 ) ,
15- applyLayout : async ( nodes ) => {
16+ applyLayout : ( nodes : any ) => {
1617 return {
17- nodes : nodes . map ( ( node , index ) => ( {
18+ nodes : nodes . map ( ( node : any , index : number ) => ( {
1819 ...node ,
1920 position : { x : ( index + 1 ) * 100 , y : ( index + 1 ) * 100 } ,
2021 } ) ) ,
@@ -144,7 +145,7 @@ const renderDiagramEditor = async ({
144145 return result ;
145146} ;
146147
147- describe . only ( 'DiagramEditor' , function ( ) {
148+ describe ( 'DiagramEditor' , function ( ) {
148149 let store : DataModelingStore ;
149150
150151 context ( 'with initial diagram' , function ( ) {
@@ -160,7 +161,7 @@ describe.only('DiagramEditor', function () {
160161 } ) ;
161162 } ) ;
162163
163- it ( 'applies the initial layout to unpositioned nodes' , async function ( ) {
164+ it ( 'applies the initial layout to unpositioned nodes' , function ( ) {
164165 const state = store . getState ( ) ;
165166
166167 expect ( state . diagram ?. edits . current ) . to . have . lengthOf ( 1 ) ;
@@ -191,7 +192,7 @@ describe.only('DiagramEditor', function () {
191192 } ) ;
192193 } ) ;
193194
194- it ( 'does not change the position of the nodes' , async function ( ) {
195+ it ( 'does not change the position of the nodes' , function ( ) {
195196 const state = store . getState ( ) ;
196197
197198 expect ( state . diagram ?. edits . current ) . to . have . lengthOf ( 1 ) ;
@@ -200,11 +201,15 @@ describe.only('DiagramEditor', function () {
200201 Edit ,
201202 { type : 'SetModel' }
202203 > ;
204+ const storedEdit = storageItems [ 0 ] . edits [ 0 ] as Extract <
205+ Edit ,
206+ { type : 'SetModel' }
207+ > ;
203208 expect ( initialEdit . model ?. collections [ 0 ] . displayPosition ) . to . deep . equal (
204- storageItems [ 0 ] . edits [ 0 ] . model . collections [ 0 ] . displayPosition
209+ storedEdit . model . collections [ 0 ] . displayPosition
205210 ) ;
206211 expect ( initialEdit . model ?. collections [ 1 ] . displayPosition ) . to . deep . equal (
207- storageItems [ 0 ] . edits [ 0 ] . model . collections [ 1 ] . displayPosition
212+ storedEdit . model . collections [ 1 ] . displayPosition
208213 ) ;
209214 } ) ;
210215 } ) ;
0 commit comments