26 lines
582 B
Go
26 lines
582 B
Go
package workflow
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestRegistryNoop(t *testing.T) {
|
|
registry := NewRegistry()
|
|
output, err := registry.Execute(context.Background(), "noop", []byte(`{"ok":true}`))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if string(output) != `{"ok":true}` {
|
|
t.Fatalf("unexpected output %s", output)
|
|
}
|
|
}
|
|
|
|
func TestRegistryUnknownOperation(t *testing.T) {
|
|
registry := NewRegistry()
|
|
_, err := registry.Execute(context.Background(), "missing", nil)
|
|
if !errors.Is(err, ErrExecutorNotFound) {
|
|
t.Fatalf("expected ErrExecutorNotFound, got %v", err)
|
|
}
|
|
}
|