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

Function TestLinearNode_AddTransition

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

Source from the content-addressed store, hash-verified

17 "github.com/stretchr/testify/assert"
18 "github.com/stretchr/testify/require"
19)
20
21func TestLinearNode_AddTransition(t *testing.T) {
22 t.Run("adds transition for a port", func(t *testing.T) {
23 n := NewLinearNode("n1")
24 err := n.AddTransition(PortCtrl, Transition{TargetID: "next"})
25 require.NoError(t, err)
26 })
27
28 t.Run("rejects duplicate transition on the same port", func(t *testing.T) {
29 n := NewLinearNode("n1")
30 require.NoError(t, n.AddTransition(PortCtrl, Transition{TargetID: "next"}))
31 err := n.AddTransition(PortCtrl, Transition{TargetID: "other"})
32 require.Error(t, err)
33 assert.Contains(t, err.Error(), "duplicate transition")
34 })
35
36 t.Run("allows distinct ports on the same node", func(t *testing.T) {
37 n := NewLinearNode("n1")
38 require.NoError(t, n.AddTransition(PortTrue, Transition{TargetID: "t-target"}))
39 require.NoError(t, n.AddTransition(PortFalse, Transition{TargetID: "f-target"}))
40 })
41}
42

Callers

nothing calls this directly

Calls 4

AddTransitionMethod · 0.95
NewLinearNodeFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected