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

Function TestTriggerNode

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

Source from the content-addressed store, hash-verified

119 assert.Equal(t, "tool-id", n.ID())
120 })
121}
122
123func TestTriggerNode(t *testing.T) {
124 t.Run("AddTransition records target the first time", func(t *testing.T) {
125 tn := NewTriggerNode("trig")
126 require.NoError(t, tn.AddTransition("", Transition{TargetID: "first"}))
127 assert.Equal(t, "first", tn.Target())
128 })
129
130 t.Run("AddTransition twice errors", func(t *testing.T) {
131 tn := NewTriggerNode("trig")
132 require.NoError(t, tn.AddTransition("", Transition{TargetID: "first"}))
133 err := tn.AddTransition("", Transition{TargetID: "second"})
134 require.Error(t, err)
135 assert.Contains(t, err.Error(), "already has target")
136 })
137
138 t.Run("Target is empty before any transition is wired", func(t *testing.T) {
139 tn := NewTriggerNode("trig")
140 assert.Empty(t, tn.Target())
141 })
142
143 t.Run("Emit applies the outgoing transition's side effects", func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AddTransitionMethod · 0.95
TargetMethod · 0.95
NewTriggerNodeFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected