mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-19 08:03:16 +00:00
test(frontend): pin that topologicalSort tolerates a missing parent node
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
|
||||
// Mock modules that transitively import CSS/Monaco
|
||||
vi.mock('monaco-editor', () => ({}))
|
||||
vi.mock('@xyflow/svelte', () => ({}))
|
||||
vi.mock('./renderers/nodes/AssetNode.svelte', () => ({
|
||||
assetDisplaysAsOutputInFlowGraph: () => false
|
||||
}))
|
||||
vi.mock('../modulesTest.svelte', () => ({}))
|
||||
|
||||
import { topologicalSort } from './graphBuilder.svelte'
|
||||
|
||||
describe('topologicalSort', () => {
|
||||
it('skips parent ids with no node instead of throwing', () => {
|
||||
const sorted = topologicalSort([
|
||||
{ id: 'a' },
|
||||
{ id: 'b', parentIds: ['a'] },
|
||||
{ id: 'orphan', parentIds: ['deleted'] }
|
||||
])
|
||||
|
||||
expect(sorted.map((n) => n.id)).toEqual(['orphan', 'b', 'a'])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user