MCPcopy
hub / github.com/pocketbase/pocketbase / TestHookLength

Function TestHookLength

tools/hook/hook_test.go:53–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestHookLength(t *testing.T) {
54 h := Hook[*Event]{}
55
56 if l := h.Length(); l != 0 {
57 t.Fatalf("Expected 0 hook handlers, got %d", l)
58 }
59
60 h.BindFunc(func(e *Event) error { return e.Next() })
61 h.BindFunc(func(e *Event) error { return e.Next() })
62
63 if l := h.Length(); l != 2 {
64 t.Fatalf("Expected 2 hook handlers, got %d", l)
65 }
66}
67
68func TestHookUnbind(t *testing.T) {
69 h := Hook[*Event]{}

Callers

nothing calls this directly

Calls 3

NextMethod · 0.65
LengthMethod · 0.45
BindFuncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…