Files
poiesis/internal/functions/functions_test.go
2026-01-28 21:55:20 -05:00

31 lines
647 B
Go

package functions
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type TestArgs struct {
Field1 string `json:"field1"`
}
func (t TestArgs) Validate() error {
return nil
}
func TestAsyncFunction(t *testing.T) {
RegisterAsyncFunction("testAsync", func(_ context.Context, args TestArgs) (string, error) {
return "result: " + args.Field1, nil
})
fn, ok := functionRegistry["testAsync"]
require.True(t, ok, "testAsync should be registered")
assert.Contains(t, fn.Definition(), "Promise<string>", "definition should include Promise<string>")
}
// TOOD: Test Normal Function