test: add missing tests for cluster edges, handles, colors, and none check method

- backend: cluster edge creation with source/target handles, handle persistence through PATCH
- frontend: cluster color in edgeColors, onConnect preserves sourceHandle/targetHandle
This commit is contained in:
Pouzor
2026-03-08 11:41:09 +01:00
parent 8de4f9b32d
commit e306cd7b49
3 changed files with 50 additions and 1 deletions
@@ -117,6 +117,14 @@ describe('canvasStore', () => {
expect(hasUnsavedChanges).toBe(true)
})
it('onConnect preserves sourceHandle and targetHandle for cluster edges', () => {
useCanvasStore.getState().onConnect({ source: 'n1', target: 'n2', sourceHandle: 'cluster-right', targetHandle: 'cluster-left' })
const { edges } = useCanvasStore.getState()
expect(edges).toHaveLength(1)
expect(edges[0].sourceHandle).toBe('cluster-right')
expect(edges[0].targetHandle).toBe('cluster-left')
})
it('addNode with parent_id sets parentId and extent', () => {
useCanvasStore.getState().addNode(makeNode('parent'))
useCanvasStore.getState().addNode(makeNode('child', { parent_id: 'parent' }))