1
1
const mockDiagramming = {
2
2
// Keep original exports by spreading them (if needed)
3
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
3
4
...require ( '@mongodb-js/diagramming' ) ,
4
5
5
6
// Override Diagram import because it's causing esm/cjs interop issues
6
- Diagram : ( props ) => (
7
+ Diagram : ( props : any ) => (
7
8
< div data-testid = "mock-diagram" >
8
9
{ Object . entries ( props ) . map ( ( [ key , value ] ) => (
9
10
< div key = { key } data-testid = { `diagram-prop-${ key } ` } >
@@ -12,9 +13,9 @@ const mockDiagramming = {
12
13
) ) }
13
14
</ div >
14
15
) ,
15
- applyLayout : async ( nodes ) => {
16
+ applyLayout : ( nodes : any ) => {
16
17
return {
17
- nodes : nodes . map ( ( node , index ) => ( {
18
+ nodes : nodes . map ( ( node : any , index : number ) => ( {
18
19
...node ,
19
20
position : { x : ( index + 1 ) * 100 , y : ( index + 1 ) * 100 } ,
20
21
} ) ) ,
@@ -144,7 +145,7 @@ const renderDiagramEditor = async ({
144
145
return result ;
145
146
} ;
146
147
147
- describe . only ( 'DiagramEditor' , function ( ) {
148
+ describe ( 'DiagramEditor' , function ( ) {
148
149
let store : DataModelingStore ;
149
150
150
151
context ( 'with initial diagram' , function ( ) {
@@ -160,7 +161,7 @@ describe.only('DiagramEditor', function () {
160
161
} ) ;
161
162
} ) ;
162
163
163
- it ( 'applies the initial layout to unpositioned nodes' , async function ( ) {
164
+ it ( 'applies the initial layout to unpositioned nodes' , function ( ) {
164
165
const state = store . getState ( ) ;
165
166
166
167
expect ( state . diagram ?. edits . current ) . to . have . lengthOf ( 1 ) ;
@@ -191,7 +192,7 @@ describe.only('DiagramEditor', function () {
191
192
} ) ;
192
193
} ) ;
193
194
194
- it ( 'does not change the position of the nodes' , async function ( ) {
195
+ it ( 'does not change the position of the nodes' , function ( ) {
195
196
const state = store . getState ( ) ;
196
197
197
198
expect ( state . diagram ?. edits . current ) . to . have . lengthOf ( 1 ) ;
@@ -200,11 +201,15 @@ describe.only('DiagramEditor', function () {
200
201
Edit ,
201
202
{ type : 'SetModel' }
202
203
> ;
204
+ const storedEdit = storageItems [ 0 ] . edits [ 0 ] as Extract <
205
+ Edit ,
206
+ { type : 'SetModel' }
207
+ > ;
203
208
expect ( initialEdit . model ?. collections [ 0 ] . displayPosition ) . to . deep . equal (
204
- storageItems [ 0 ] . edits [ 0 ] . model . collections [ 0 ] . displayPosition
209
+ storedEdit . model . collections [ 0 ] . displayPosition
205
210
) ;
206
211
expect ( initialEdit . model ?. collections [ 1 ] . displayPosition ) . to . deep . equal (
207
- storageItems [ 0 ] . edits [ 0 ] . model . collections [ 1 ] . displayPosition
212
+ storedEdit . model . collections [ 1 ] . displayPosition
208
213
) ;
209
214
} ) ;
210
215
} ) ;
0 commit comments