2026-07-11 09:26:16 +02:00
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
import {
|
|
|
|
|
DEFERRED_TOPOLOGY_EDGE_KINDS,
|
|
|
|
|
DESIGNER_EDGE_KINDS,
|
2026-07-11 09:27:56 +02:00
|
|
|
edgeKindNeedsGroupKey,
|
|
|
|
|
resolveDependencyEndpoints,
|
2026-07-11 09:26:16 +02:00
|
|
|
} from './gateGraphTopology.js'
|
|
|
|
|
|
|
|
|
|
describe('gateGraphTopology', () => {
|
2026-07-11 09:27:56 +02:00
|
|
|
it('includes topology kinds in designer', () => {
|
2026-07-11 09:26:16 +02:00
|
|
|
expect(DESIGNER_EDGE_KINDS).toContain('requires')
|
2026-07-11 09:27:56 +02:00
|
|
|
expect(DESIGNER_EDGE_KINDS).toContain('parallel_group')
|
|
|
|
|
expect(DESIGNER_EDGE_KINDS).toContain('optional_branch')
|
2026-07-11 09:26:16 +02:00
|
|
|
for (const kind of DEFERRED_TOPOLOGY_EDGE_KINDS) {
|
2026-07-11 09:27:56 +02:00
|
|
|
expect(DESIGNER_EDGE_KINDS).toContain(kind)
|
2026-07-11 09:26:16 +02:00
|
|
|
}
|
|
|
|
|
})
|
2026-07-11 09:27:56 +02:00
|
|
|
|
|
|
|
|
it('requires group_key for parallel_group', () => {
|
|
|
|
|
expect(edgeKindNeedsGroupKey('parallel_group')).toBe(true)
|
|
|
|
|
expect(edgeKindNeedsGroupKey('requires')).toBe(false)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('resolves requires edge direction for join semantics', () => {
|
|
|
|
|
expect(resolveDependencyEndpoints('requires', 'a', 'b')).toEqual({
|
|
|
|
|
from_item_id: 'b',
|
|
|
|
|
to_item_id: 'a',
|
|
|
|
|
})
|
|
|
|
|
expect(resolveDependencyEndpoints('optional_branch', 'a', 'b')).toEqual({
|
|
|
|
|
from_item_id: 'a',
|
|
|
|
|
to_item_id: 'b',
|
|
|
|
|
})
|
|
|
|
|
})
|
2026-07-11 09:26:16 +02:00
|
|
|
})
|