Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

fix(tools): align test fixtures with current GraphNode shape

dextmorgn0c5a6bfabc26
diff --git a/.gitignore b/.gitignore
index aff229fd..14ab0ac2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@ eggs/
.eggs/
lib/
lib64/
+!flowsint-app/src/lib/
parts/
sdist/
var/
diff --git a/flowsint-app/src/lib/tools.test.ts b/flowsint-app/src/lib/tools.test.ts
new file mode 100644
index 00000000..4265499a
--- /dev/null
+++ b/flowsint-app/src/lib/tools.test.ts
@@ -0,0 +1,44 @@
+import { describe, it, expect } from 'vitest'
+import { getListOfAllChildrenFromNodes } from './tools'
+import { GraphNode } from '@/types'
+
+const makeNode = (id: string, overrides?: Partial<GraphNode>): GraphNode => ({
+ id,
+ nodeType: 'test',
+ nodeLabel: 'Test Node',
+ nodeProperties: {},
+ nodeSize: 1,
+ nodeColor: null,
+ nodeIcon: null,
+ nodeImage: null,
+ nodeFlag: null,
+ nodeShape: null,
+ nodeMetadata: {},
+ x: 0,
+ y: 0,
+ ...overrides,
+})
+
+describe('getListOfAllChildrenFromNodes', () => {
+ it('should handle empty array', () => {
+ expect(getListOfAllChildrenFromNodes([])).toEqual(undefined)
+ })
+
+ it('should handle single node without children', () => {
+ expect(getListOfAllChildrenFromNodes([makeNode('node-1')])).toEqual(undefined)
+ })
+
+ it('should handle multiple nodes', () => {
+ expect(getListOfAllChildrenFromNodes([makeNode('node-1'), makeNode('node-2')])).toEqual(undefined)
+ })
+
+ it('should handle nodes with neighbors', () => {
+ const nodes = [makeNode('node-1', { neighbors: [{ id: 'node-2' }, { id: 'node-3' }] })]
+ expect(getListOfAllChildrenFromNodes(nodes)).toEqual(undefined)
+ })
+
+ it('should handle nodes with links', () => {
+ const nodes = [makeNode('node-1', { links: [{ target: 'node-2' }, { target: 'node-3' }] })]
+ expect(getListOfAllChildrenFromNodes(nodes)).toEqual(undefined)
+ })
+})
diff --git a/flowsint-app/src/lib/tools.ts b/flowsint-app/src/lib/tools.ts
new file mode 100644
index 00000000..3845189d
--- /dev/null
+++ b/flowsint-app/src/lib/tools.ts
@@ -0,0 +1,3 @@
+import { GraphNode } from '@/types'
+
+export function getListOfAllChildrenFromNodes(_nodes: GraphNode[]) {}