(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func 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 | |
| 91 | func TestFunctionCall_Outputs(t *testing.T) { |
| 92 | t.Run("emits returns with emit-mode bindings", func(t *testing.T) { |
nothing calls this directly
no test coverage detected