Documentation
¶
Overview ¶
Package testutil provides utilities for integration testing agnt components.
It includes helpers for: - Setting up test web servers - Creating mock agents for PTY testing - Managing test daemon instances - Common test fixtures and assertions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequireChrome ¶
RequireChrome skips the test if Chrome is not available.
Types ¶
type MockAgent ¶
type MockAgent struct {
Cmd *exec.Cmd
Stdin io.WriteCloser
Stdout io.ReadCloser
Stderr io.ReadCloser
// contains filtered or unexported fields
}
MockAgent represents a mock AI agent process for PTY testing.
func StartMockAgent ¶
func StartMockAgent(t *testing.T, opts ...MockAgentOption) *MockAgent
StartMockAgent starts the mock agent process.
func (*MockAgent) ClearOutput ¶
func (a *MockAgent) ClearOutput()
ClearOutput clears the output buffer.
type MockAgentOption ¶
type MockAgentOption func(*mockAgentConfig)
MockAgentOption configures the mock agent.
func WithDelay ¶
func WithDelay(ms int) MockAgentOption
WithDelay sets the response delay in milliseconds.
func WithOutputLines ¶
func WithOutputLines(n int) MockAgentOption
WithOutputLines sets the number of output lines per response.
type RequestLog ¶
RequestLog stores information about a request.
type TestWebApp ¶
type TestWebApp struct {
Server *httptest.Server
URL string
Requests []RequestLog
// contains filtered or unexported fields
}
TestWebApp represents a test web application server.
func NewTestWebApp ¶
func NewTestWebApp(t *testing.T) *TestWebApp
NewTestWebApp creates a test web server that serves the static test pages.
func (*TestWebApp) ClearRequests ¶
func (app *TestWebApp) ClearRequests()
ClearRequests clears the request log.
func (*TestWebApp) GetRequestCount ¶
func (app *TestWebApp) GetRequestCount() int
GetRequestCount returns the number of requests received.
func (*TestWebApp) GetRequests ¶
func (app *TestWebApp) GetRequests() []RequestLog
GetRequests returns a copy of all logged requests.