Skip to content

Commit 18f2ebd

Browse files
committed
fix: tests
1 parent da207ed commit 18f2ebd

File tree

6 files changed

+145
-291
lines changed

6 files changed

+145
-291
lines changed

packages/fossflow-lib/src/hooks/__tests__/useHistory.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ describe('useHistory', () => {
272272
const useModelStore = require('../../stores/modelStore').useModelStore;
273273
const useSceneStore = require('../../stores/sceneStore').useSceneStore;
274274

275-
useModelStore.mockImplementation((selector) => {
275+
useModelStore.mockImplementation((selector: (state: { actions: undefined }) => unknown) => {
276276
const state = { actions: undefined };
277277
return selector ? selector(state) : state;
278278
});
279-
useSceneStore.mockImplementation((selector) => {
279+
useSceneStore.mockImplementation((selector: (state: { actions: undefined }) => unknown) => {
280280
const state = { actions: undefined };
281281
return selector ? selector(state) : state;
282282
});
@@ -297,11 +297,11 @@ describe('useHistory', () => {
297297
});
298298

299299
// Restore mocks for other tests
300-
useModelStore.mockImplementation((selector) => {
300+
useModelStore.mockImplementation((selector: (state: { actions: typeof mockModelStore }) => unknown) => {
301301
const state = { actions: mockModelStore };
302302
return selector ? selector(state) : state;
303303
});
304-
useSceneStore.mockImplementation((selector) => {
304+
useSceneStore.mockImplementation((selector: (state: { actions: typeof mockSceneStore }) => unknown) => {
305305
const state = { actions: mockSceneStore };
306306
return selector ? selector(state) : state;
307307
});

packages/fossflow-lib/src/hooks/__tests__/useInitialDataManager.test.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ describe('useInitialDataManager - Orphaned Connector Handling', () => {
107107
{
108108
id: 'connector1',
109109
anchors: [
110-
{ id: 'anchor1', ref: { item: 'item1' }, face: 'right' },
111-
{ id: 'anchor2', ref: { item: 'item2' }, face: 'left' }
110+
{ id: 'anchor1', ref: { item: 'item1' } },
111+
{ id: 'anchor2', ref: { item: 'item2' } }
112112
]
113113
},
114114
{
115115
id: 'connector2',
116116
anchors: [
117-
{ id: 'anchor3', ref: { item: 'item1' }, face: 'top' },
118-
{ id: 'anchor4', ref: { item: 'nonexistent' }, face: 'bottom' } // Invalid reference
117+
{ id: 'anchor3', ref: { item: 'item1' } },
118+
{ id: 'anchor4', ref: { item: 'nonexistent' } } // Invalid reference
119119
]
120120
},
121121
{
122122
id: 'connector3',
123123
anchors: [
124-
{ id: 'anchor5', ref: { item: 'nonexistent1' }, face: 'right' }, // Invalid reference
125-
{ id: 'anchor6', ref: { item: 'nonexistent2' }, face: 'left' } // Invalid reference
124+
{ id: 'anchor5', ref: { item: 'nonexistent1' } }, // Invalid reference
125+
{ id: 'anchor6', ref: { item: 'nonexistent2' } } // Invalid reference
126126
]
127127
}
128128
],
@@ -167,8 +167,8 @@ describe('useInitialDataManager - Orphaned Connector Handling', () => {
167167
{
168168
id: 'connector1',
169169
anchors: [
170-
{ id: 'anchor1', ref: { item: 'item1' }, face: 'right' },
171-
{ id: 'anchor2', ref: { anchor: 'anchor3' }, face: 'left' } // References another anchor
170+
{ id: 'anchor1', ref: { item: 'item1' } },
171+
{ id: 'anchor2', ref: { anchor: 'anchor3' } } // References another anchor
172172
]
173173
}
174174
],
@@ -237,15 +237,15 @@ describe('useInitialDataManager - Orphaned Connector Handling', () => {
237237
{
238238
id: 'connector1',
239239
anchors: [
240-
{ id: 'anchor1', ref: { item: 'nonexistent1' }, face: 'right' },
241-
{ id: 'anchor2', ref: { item: 'nonexistent2' }, face: 'left' }
240+
{ id: 'anchor1', ref: { item: 'nonexistent1' } },
241+
{ id: 'anchor2', ref: { item: 'nonexistent2' } }
242242
]
243243
},
244244
{
245245
id: 'connector2',
246246
anchors: [
247-
{ id: 'anchor3', ref: { item: 'deleted1' }, face: 'top' },
248-
{ id: 'anchor4', ref: { item: 'deleted2' }, face: 'bottom' }
247+
{ id: 'anchor3', ref: { item: 'deleted1' } },
248+
{ id: 'anchor4', ref: { item: 'deleted2' } }
249249
]
250250
}
251251
],
@@ -287,9 +287,9 @@ describe('useInitialDataManager - Orphaned Connector Handling', () => {
287287
{
288288
id: 'connector1',
289289
anchors: [
290-
{ id: 'anchor1', ref: { item: 'item1' }, face: 'right' }, // Valid
291-
{ id: 'anchor2', ref: { item: 'item2' }, face: 'left' }, // Valid
292-
{ id: 'anchor3', ref: { item: 'nonexistent' }, face: 'top' } // Invalid
290+
{ id: 'anchor1', ref: { item: 'item1' } }, // Valid
291+
{ id: 'anchor2', ref: { item: 'item2' } }, // Valid
292+
{ id: 'anchor3', ref: { item: 'nonexistent' } } // Invalid
293293
]
294294
}
295295
],
@@ -328,8 +328,8 @@ describe('useInitialDataManager - Orphaned Connector Handling', () => {
328328
{
329329
id: 'connector1',
330330
anchors: [
331-
{ id: 'anchor1', ref: { item: 'nonexistent' }, face: 'right' },
332-
{ id: 'anchor2', ref: { item: 'item1' }, face: 'left' }
331+
{ id: 'anchor1', ref: { item: 'nonexistent' } },
332+
{ id: 'anchor2', ref: { item: 'item1' } }
333333
]
334334
}
335335
],
@@ -401,15 +401,15 @@ describe('useInitialDataManager - Orphaned Connector Handling', () => {
401401
{
402402
id: 'connector1',
403403
anchors: [
404-
{ id: 'anchor1', ref: { item: 'item1' }, face: 'right' },
405-
{ id: 'anchor2', ref: { item: 'item2' }, face: 'left' }
404+
{ id: 'anchor1', ref: { item: 'item1' } },
405+
{ id: 'anchor2', ref: { item: 'item2' } }
406406
]
407407
},
408408
{
409409
id: 'connector2',
410410
anchors: [
411-
{ id: 'anchor3', ref: { item: 'item2' }, face: 'right' },
412-
{ id: 'anchor4', ref: { item: 'item3' }, face: 'left' }
411+
{ id: 'anchor3', ref: { item: 'item2' } },
412+
{ id: 'anchor4', ref: { item: 'item3' } }
413413
]
414414
}
415415
],

0 commit comments

Comments
 (0)