You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: hook_test.go
    path of file: ./repos/pocketbase/tools/hook
    
    the code of the file until where you have to start completion: package hook

import (
	"errors"
	"testing"
)

func TestHookAddAndPreAdd(t *testing.T) {
	h := Hook[int]{}

	if total := len(h.handlers); total != 0 {
		t.Fatalf("Expected no handlers, found %d", total)
	}

	triggerSequence := ""

	f1 := func(data int) error { triggerSequence += "f1"; return nil }
	f2 := func(data int) error { triggerSequence += "f2"; return nil }
	f3 := func(data int) error { triggerSequence += "f3"; return nil }
	f4 := func(data int) error { triggerSequence += "f4"; return nil }

	h.Add
    
func TestHookTrigger(t *testing.T) {
	err1 := errors.New("demo")
	err2 := errors.New("demo")

	scenarios := []struct {
		handlers      []Handler[int]
		expectedError error
	}{
		{
			[]Handler[int]{
				func(data int) error { return nil },
				func(data int) error { return nil },
			},
			nil,
		},
		{
			[]Handler[int]{
				func(data int) error { return nil },
				func(data int) error { return err1 },
				func(data int) error { return err2 },
			},
			err1,
		},
	}

	for i, scenario := range scenarios {
		h := Hook[int]{}
		for _, handler := range scenario.handlers {
			h.Add(handler)
		}
		result := h.Trigger(1)
		if result != scenario.expectedError {
			t.Fatalf("(%d) Expected %v, got %v", i, scenario.expectedError, result)
		}
	}
}