MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / TestBranchingNode

Function TestBranchingNode

go/engine/node_test.go:84–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82 assert.Contains(t, err.Error(), PortCtrl)
83 })
84}
85
86func TestBranchingNode(t *testing.T) {
87 t.Run("AddTransition accumulates multiple targets per port", func(t *testing.T) {
88 n := NewBranchingNode("b")
89 require.NoError(t, n.AddTransition(PortCtrl, Transition{TargetID: "a"}))
90 require.NoError(t, n.AddTransition(PortCtrl, Transition{TargetID: "b"}))
91
92 brs := n.Transitions(PortCtrl)
93 require.Len(t, brs, 2)
94 assert.Equal(t, "a", brs[0].TargetID)
95 assert.Equal(t, "b", brs[1].TargetID)
96 })
97
98 t.Run("Transitions on unknown port returns nil", func(t *testing.T) {
99 n := NewBranchingNode("b")
100 assert.Empty(t, n.Transitions("nope"))
101 })
102
103 t.Run("ID returns the configured id", func(t *testing.T) {
104 n := NewBranchingNode("xyz")
105 assert.Equal(t, "xyz", n.ID())
106 })
107}
108

Callers

nothing calls this directly

Calls 6

AddTransitionMethod · 0.95
TransitionsMethod · 0.95
IDMethod · 0.95
NewBranchingNodeFunction · 0.85
LenMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected