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

Function TestNewFunctionCall

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

Source from the content-addressed store, hash-verified

47}
48
49func TestNewFunctionCall(t *testing.T) {
50 t.Run("missing input binding errors", func(t *testing.T) {
51 fn := passthroughFn()
52 _, err := NewFunctionCall("fc", fn,
53 map[string]workflowapi.Expression{}, // no binding for arg "a"
54 map[string]workflowapi.OutputBinding{
55 "ret": {Active: true, Mode: workflowapi.OutputBindingModeEmit},
56 },
57 "",
58 )
59 require.Error(t, err)
60 assert.Contains(t, err.Error(), "missing input binding")
61 })
62
63 t.Run("missing output binding errors", func(t *testing.T) {
64 fn := passthroughFn()
65 _, err := NewFunctionCall("fc", fn,
66 map[string]workflowapi.Expression{
67 "a": {Expression: "1", DataType: workflowapi.Int},
68 },
69 map[string]workflowapi.OutputBinding{}, // no binding for return "ret"
70 "",
71 )
72 require.Error(t, err)
73 assert.Contains(t, err.Error(), "missing output binding")
74 })
75
76 t.Run("constructs successfully when all bindings provided", func(t *testing.T) {
77 fn := passthroughFn()
78 _, err := NewFunctionCall("fc", fn,
79 map[string]workflowapi.Expression{
80 "a": {Expression: "1", DataType: workflowapi.Int},
81 },
82 map[string]workflowapi.OutputBinding{
83 "ret": {Active: true, Mode: workflowapi.OutputBindingModeEmit},
84 },
85 "",
86 )
87 require.NoError(t, err)
88 })
89}
90
91func TestFunctionCall_Outputs(t *testing.T) {
92 t.Run("emits returns with emit-mode bindings", func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

passthroughFnFunction · 0.85
NewFunctionCallFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected