Skip to content

Commit 76068af

Browse files
committed
chore(37943): fix ts
1 parent b9efab6 commit 76068af

File tree

1 file changed

+21
-38
lines changed

1 file changed

+21
-38
lines changed

hivemq-edge-frontend/src/modules/Workspace/utils/layout/manual-layout.spec.ts

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,12 @@ describe('ManualLayoutAlgorithm', () => {
3131
})
3232

3333
describe('validateOptions', () => {
34-
it('should always return valid for any options', () => {
35-
const result1 = algorithm.validateOptions({})
36-
const result2 = algorithm.validateOptions({ anything: 'goes' } as never)
37-
const result3 = algorithm.validateOptions({ foo: 123, bar: true } as never)
34+
it('should always return valid', () => {
35+
const result = algorithm.validateOptions()
3836

39-
expect(result1.valid).toBe(true)
40-
expect(result2.valid).toBe(true)
41-
expect(result3.valid).toBe(true)
42-
})
43-
44-
it('should handle undefined options', () => {
45-
const result = algorithm.validateOptions(undefined as unknown as Record<string, unknown>)
46-
expect(result.valid).toBe(true)
47-
})
48-
49-
it('should handle null options', () => {
50-
const result = algorithm.validateOptions(null as unknown as Record<string, unknown>)
5137
expect(result.valid).toBe(true)
38+
expect(result.errors).toEqual([])
39+
expect(result.warnings).toEqual([])
5240
})
5341
})
5442

@@ -65,7 +53,7 @@ describe('ManualLayoutAlgorithm', () => {
6553
{ id: 'e2-3', source: '2', target: '3' },
6654
]
6755

68-
const result = await algorithm.apply(nodes, edges, {})
56+
const result = await algorithm.apply(nodes, edges)
6957

7058
expect(result.success).toBe(true)
7159
expect(result.nodes).toHaveLength(3)
@@ -80,13 +68,13 @@ describe('ManualLayoutAlgorithm', () => {
8068
{ id: 'node-2', type: 'edge', position: { x: 100, y: 100 }, data: {} },
8169
]
8270

83-
const result = await algorithm.apply(nodes, [], {})
71+
const result = await algorithm.apply(nodes, [])
8472

8573
expect(result.nodes.map((n) => n.id)).toEqual(['node-1', 'node-2'])
8674
})
8775

8876
it('should handle empty node array', async () => {
89-
const result = await algorithm.apply([], [], {})
77+
const result = await algorithm.apply([], [])
9078

9179
expect(result.success).toBe(true)
9280
expect(result.nodes).toEqual([])
@@ -99,7 +87,7 @@ describe('ManualLayoutAlgorithm', () => {
9987
{ id: '2', type: 'edge', position: { x: 150, y: 150 }, data: {} },
10088
]
10189

102-
const result = await algorithm.apply(nodes, [], {})
90+
const result = await algorithm.apply(nodes, [])
10391

10492
expect(result.success).toBe(true)
10593
expect(result.nodes).toHaveLength(2)
@@ -114,34 +102,29 @@ describe('ManualLayoutAlgorithm', () => {
114102
}))
115103

116104
const startTime = performance.now()
117-
const result = await algorithm.apply(nodes, [], {})
105+
const result = await algorithm.apply(nodes, [])
118106
const duration = performance.now() - startTime
119107

120108
expect(result.success).toBe(true)
121109
expect(duration).toBeLessThan(10) // Should be nearly instant
122110
})
123111

124-
it('should ignore any options passed', async () => {
112+
it('should not accept options parameter', async () => {
125113
const nodes: Node[] = [{ id: '1', type: 'adapter', position: { x: 10, y: 20 }, data: {} }]
126114

127-
const result1 = await algorithm.apply(nodes, [], {})
128-
const result2 = await algorithm.apply(nodes, [], { ranksep: 500, animate: true } as never)
115+
// Manual layout has simplified signature - no options parameter
116+
const result = await algorithm.apply(nodes, [])
129117

130-
expect(result1.nodes[0].position).toEqual(result2.nodes[0].position)
118+
expect(result.nodes[0].position).toEqual({ x: 10, y: 20 })
131119
})
132120

133-
it('should ignore constraints', async () => {
121+
it('should not accept constraints parameter', async () => {
134122
const nodes: Node[] = [{ id: '1', type: 'adapter', position: { x: 10, y: 20 }, data: {} }]
135123

136-
const constraints = {
137-
fixedNodes: new Set(['1']),
138-
gluedNodes: new Map(),
139-
groupNodes: new Map(),
140-
}
141-
142-
const result = await algorithm.apply(nodes, [], {}, constraints)
124+
// Manual layout has simplified signature - no constraints parameter
125+
const result = await algorithm.apply(nodes, [])
143126

144-
// Should ignore constraint and keep original position
127+
// Should keep original position
145128
expect(result.nodes[0].position).toEqual({ x: 10, y: 20 })
146129
})
147130

@@ -152,7 +135,7 @@ describe('ManualLayoutAlgorithm', () => {
152135
{ id: '3', type: 'client', position: { x: 200, y: 200 }, data: {} },
153136
]
154137

155-
const result = await algorithm.apply(nodes, [], {})
138+
const result = await algorithm.apply(nodes, [])
156139

157140
expect(result.metadata?.algorithm).toBe(LayoutType.MANUAL)
158141
expect(result.metadata?.nodeCount).toBe(3)
@@ -167,15 +150,15 @@ describe('ManualLayoutAlgorithm', () => {
167150

168151
const edges: Edge[] = [{ id: 'e1-2', source: '1', target: '2' }]
169152

170-
const result = await algorithm.apply(nodes, edges, {})
153+
const result = await algorithm.apply(nodes, edges)
171154

172155
expect(result.metadata?.edgeCount).toBe(1)
173156
})
174157

175158
it('should have minimal duration', async () => {
176159
const nodes: Node[] = [{ id: '1', type: 'adapter', position: { x: 0, y: 0 }, data: {} }]
177160

178-
const result = await algorithm.apply(nodes, [], {})
161+
const result = await algorithm.apply(nodes, [])
179162

180163
expect(result.duration).toBeGreaterThanOrEqual(0)
181164
expect(result.duration).toBeLessThan(5)
@@ -193,7 +176,7 @@ describe('ManualLayoutAlgorithm', () => {
193176
},
194177
]
195178

196-
const result = await algorithm.apply(nodes, [], {})
179+
const result = await algorithm.apply(nodes, [])
197180

198181
const node = result.nodes[0]
199182
expect(node.id).toBe('complex-node')

0 commit comments

Comments
 (0)