Documentation
¶
Overview ¶
Package agenthookstest provides the golden fixture corpus and a fake-provider harness so hook binaries built on agenthooks can be integration-tested in CI without the actual agents (DESIGN.md §10).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FixturesFS embed.FS
Functions ¶
func AssertNoOp ¶
func AssertNoOp(tb testing.TB, provider agenthooks.Provider, res Result)
AssertNoOp fails unless the result is the provider's correct "no opinion" form — the round-trip property of DESIGN.md §5.4.
func FixtureDir ¶
func FixtureDir(p agenthooks.Provider) string
FixtureDir maps a Provider to its fixture directory name.
Types ¶
type FakeAgent ¶
type FakeAgent struct {
Provider agenthooks.Provider
Binary string
Args []string // defaults to the generated-config argv contract
Env []string // appended to the inherited environment
}
FakeAgent spawns a consumer binary exactly like a provider does: payload on stdin (or argv), provider env cross-set the way real agents cross-set it, and the provider's exit-code interpretation left to the caller.
type Result ¶
Result captures one hook invocation's wire output.
func Invoke ¶
func Invoke(tb testing.TB, r *agenthooks.Runner, provider agenthooks.Provider, payload []byte, extraArgs ...string) Result
Invoke runs the Runner in-process exactly as the generated config would: stdin payload, --provider flag, streams captured. For Cursor tool events construct the Runner with agenthooks.WithoutDedup() (or a per-test WithDedupDir) so cross-test markers can't collide. Tests that count handler invocations should also pass agenthooks.WithoutBackfill() (or an isolated WithDedupDir): prompt-implied events can synthesize a reporting-only prompt.submitted, keyed by machine-global session markers.