testutil

package
v0.0.0-...-974d72c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package testutil provides shared test helpers for internal packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentTaskRepository

func AgentTaskRepository(tb testing.TB, connection *sql.DB) *database.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

func DocumentRepository(tb testing.TB, connection *sql.DB) *database.DocumentRepository

DocumentRepository constructs a document repository or fails the test.

func NewAuthStorage

func NewAuthStorage(t *testing.T, credentials map[string]auth.Credential) *auth.Storage

NewAuthStorage creates file-backed auth storage seeded with credentials.

func OpenMemoryDatabase

func OpenMemoryDatabase(tb testing.TB) *sql.DB

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

func SessionRepository(tb testing.TB, connection *sql.DB) *database.SessionRepository

SessionRepository constructs a session repository or fails the test.

func TaskRepository

func TaskRepository(tb testing.TB, connection *sql.DB) *database.TaskRepository

TaskRepository constructs a task repository or fails the test.

func TestMainHome

func TestMainHome(packageName string) func(code int)

TestMainHome creates and configures an isolated librecode home and returns a TestMain cleanup callback that removes it before exiting with code.

func ToolArgumentFields

func ToolArgumentFields(input tool.Arguments) map[string]any

ToolArgumentFields decodes tool arguments into generic fields for assertions.

func ToolArguments

func ToolArguments(input map[string]any) tool.Arguments

ToolArguments converts a generic test argument map into validated tool arguments.

func ToolArgumentsJSON

func ToolArgumentsJSON(input string) tool.Arguments

ToolArgumentsJSON converts raw test JSON into validated tool arguments.

func WorkflowRepository

func WorkflowRepository(tb testing.TB, connection *sql.DB) *database.WorkflowRepository

WorkflowRepository constructs a workflow repository or fails the test.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL