Documentation
¶
Overview ¶
Package testutil provides shared test helpers for internal packages.
Index ¶
- func AgentTaskRepository(tb testing.TB, connection *sql.DB) *database.AgentTaskRepository
- func CreateChildSession(tb testing.TB, sessions *database.SessionRepository, name string, ...) *database.SessionEntity
- func CreateSession(tb testing.TB, sessions *database.SessionRepository, name string) *database.SessionEntity
- func DocumentRepository(tb testing.TB, connection *sql.DB) *database.DocumentRepository
- func NewAuthStorage(t *testing.T, credentials map[string]auth.Credential) *auth.Storage
- func OpenMemoryDatabase(tb testing.TB) *sql.DB
- func SessionRepository(tb testing.TB, connection *sql.DB) *database.SessionRepository
- func TaskRepository(tb testing.TB, connection *sql.DB) *database.TaskRepository
- func TestMainHome(packageName string) func(code int)
- func ToolArgumentFields(input tool.Arguments) map[string]any
- func ToolArguments(input map[string]any) tool.Arguments
- func ToolArgumentsJSON(input string) tool.Arguments
- func WorkflowRepository(tb testing.TB, connection *sql.DB) *database.WorkflowRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentTaskRepository ¶
AgentTaskRepository constructs an agent-task repository or fails the test.
func CreateChildSession ¶
func CreateChildSession( tb testing.TB, sessions *database.SessionRepository, name string, parentID string, ) *database.SessionEntity
CreateChildSession creates a session linked to a parent session, or fails the test.
func CreateSession ¶
func CreateSession( tb testing.TB, sessions *database.SessionRepository, name string, ) *database.SessionEntity
CreateSession creates a session with the test binary as its working directory, or fails the test.
func DocumentRepository ¶
DocumentRepository constructs a document repository or fails the test.
func NewAuthStorage ¶
NewAuthStorage creates file-backed auth storage seeded with credentials.
func OpenMemoryDatabase ¶
OpenMemoryDatabase opens an isolated in-memory SQLite database, registers schema migrations, and closes it when the test finishes. The database name is derived from the test name, so subtests get independent databases while subtests sharing cache=shared keep a single connection.
func SessionRepository ¶
SessionRepository constructs a session repository or fails the test.
func TaskRepository ¶
TaskRepository constructs a task repository or fails the test.
func TestMainHome ¶
TestMainHome creates and configures an isolated librecode home and returns a TestMain cleanup callback that removes it before exiting with code.
func ToolArgumentFields ¶
ToolArgumentFields decodes tool arguments into generic fields for assertions.
func ToolArguments ¶
ToolArguments converts a generic test argument map into validated tool arguments.
func ToolArgumentsJSON ¶
ToolArgumentsJSON converts raw test JSON into validated tool arguments.
func WorkflowRepository ¶
WorkflowRepository constructs a workflow repository or fails the test.
Types ¶
This section is empty.