summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/action_handler_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaiaction/action_handler_test.go')
-rw-r--r--internal/hexaiaction/action_handler_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/hexaiaction/action_handler_test.go b/internal/hexaiaction/action_handler_test.go
index 1d811fe..92df3b1 100644
--- a/internal/hexaiaction/action_handler_test.go
+++ b/internal/hexaiaction/action_handler_test.go
@@ -55,6 +55,10 @@ func TestActionHandlerRegistryRejectsInvalidRegistrations(t *testing.T) {
"nil handler": func(registry *actionHandlerRegistry) {
registry.register(ActionKind("nil"), nil)
},
+ "typed nil handler": func(registry *actionHandlerRegistry) {
+ var handler actionHandlerFunc
+ registry.register(ActionKind("typed-nil"), handler)
+ },
"duplicate kind": func(registry *actionHandlerRegistry) {
registry.register(ActionKind("dup"), actionHandlerFunc(handleSkipAction))
registry.register(ActionKind("dup"), actionHandlerFunc(handleSkipAction))
@@ -85,3 +89,14 @@ func TestActionHandlerRegistryNilPanicNamesKind(t *testing.T) {
}()
newActionHandlerRegistry().register(ActionCustom, nil)
}
+
+func TestActionHandlerFuncNilExecuteReturnsError(t *testing.T) {
+ var handler actionHandlerFunc
+ _, err := handler.Execute(context.Background(), actionRequest{})
+ if err == nil {
+ t.Fatal("expected error")
+ }
+ if !strings.Contains(err.Error(), "nil action handler") {
+ t.Fatalf("expected nil handler error, got %v", err)
+ }
+}