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

Function TestFunctionCall_Outputs

go/engine/node/functioncall_test.go:91–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestFunctionCall_Outputs(t *testing.T) {
92 t.Run("emits returns with emit-mode bindings", func(t *testing.T) {
93 fn := &engine.Function{
94 Info: workflowapi.FunctionInfo{
95 Id: "fn2",
96 Name: "two-returns",
97 Returns: []workflowapi.Variable{
98 {Uid: "r1", Name: "first", DataType: workflowapi.Int},
99 {Uid: "r2", Name: "second", DataType: workflowapi.String},
100 },
101 },
102 }
103 fc := &FunctionCall{}
104 // Construct manually to control bindings.
105 fc, err := NewFunctionCall("fc", fn,
106 map[string]workflowapi.Expression{},
107 map[string]workflowapi.OutputBinding{
108 "r1": {Active: true, Mode: workflowapi.OutputBindingModeEmit},
109 "r2": {
110 Active: true,
111 Mode: workflowapi.OutputBindingModeAssign,
112 Target: &workflowapi.Reference{SrcId: engine.SrcDeclared, VarId: "x"},
113 },
114 },
115 "",
116 )
117 require.NoError(t, err)
118
119 out := fc.Outputs()
120 assert.Contains(t, out, "r1")
121 assert.NotContains(t, out, "r2") // assign mode strips from emitter outputs
122 assert.Equal(t, workflowapi.Int, out["r1"])
123 })
124}
125
126func TestFunctionCall_Execute(t *testing.T) {
127 t.Run("evaluates input bindings, runs fn, applies output bindings", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

OutputsMethod · 0.95
NewFunctionCallFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected