testing

package
v0.0.0-...-c2f141e Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SkipIfNoAPIKey

func SkipIfNoAPIKey(t testing.TB, provider string)

SkipIfNoAPIKey skips the test if the API key for the provider is not set

func TestBaseURLConfiguration

func TestBaseURLConfiguration(t testing.TB, client chat.Client, expectedURL string)

TestBaseURLConfiguration validates that BaseURL is properly configured in the client

func TestEmptyToolResultsHandling

func TestEmptyToolResultsHandling(t testing.TB, client chat.Client)

TestEmptyToolResultsHandling tests that clients properly handle empty tool results without causing API errors

func TestHeaderConfiguration

func TestHeaderConfiguration(t testing.TB, client chat.Client, expectedHeaders map[string]string)

TestHeaderConfiguration validates that custom headers are properly configured in the client

func TestMessagePersistenceAfterRestore

func TestMessagePersistenceAfterRestore(t *testing.T, client chat.Client)

TestMessagePersistenceAfterRestore tests that messages are not duplicated when a session is restored from persistence and new messages are sent. This is a regression test for a bug where user messages were being pre-added to the store before calling Message(), causing them to be stored twice.

func TestNoDuplicateMessages

func TestNoDuplicateMessages(t *testing.T, client chat.Client)

TestNoDuplicateMessages tests that messages are not duplicated in history This is a regression test for a bug where chat clients were adding messages to their state even though the messages were already in the initial history

func TestStreaming

func TestStreaming(t testing.TB, client chat.Client)

TestStreaming is an alias for TestStreamingResponse for consistency

func TestStreamingResponse

func TestStreamingResponse(t testing.TB, client chat.Client)

TestStreamingResponse tests streaming functionality with system dynamics prompt

func TestSystemReminderWithToolCalls

func TestSystemReminderWithToolCalls(t testing.TB, client chat.Client)

TestSystemReminderWithToolCalls tests that system reminders are properly injected after tool execution

func TestTextBeforeToolCallsPreserved

func TestTextBeforeToolCallsPreserved(t *testing.T, client chat.Client)

TestTextBeforeToolCallsPreserved tests that text content emitted before tool calls is preserved in message history. This is a regression test for a bug where initial text content was lost when the model emitted text, then made tool calls.

func TestThinkingPreservedInHistory

func TestThinkingPreservedInHistory(t *testing.T, client chat.Client)

TestThinkingPreservedInHistory tests that thinking content is preserved in message history for models that support thinking/reasoning. This test only applies to thinking-capable models like Claude Opus 4 and Sonnet 4.

func TestThinkingPreservedWithToolCalls

func TestThinkingPreservedWithToolCalls(t *testing.T, client chat.Client)

TestThinkingPreservedWithToolCalls tests that thinking content is preserved alongside tool calls This ensures that when a model thinks and then calls tools, the thinking is retained in history

func TestTokenUsageCumulative

func TestTokenUsageCumulative(t testing.TB, client chat.Client)

TestTokenUsageCumulative tests that TokenUsage returns cumulative token counts across multiple messages

func TestToolCallAndResultStreamEvents

func TestToolCallAndResultStreamEvents(t testing.TB, client chat.Client)

TestToolCallAndResultStreamEvents tests that both tool call and tool result events are emitted during streaming

func TestToolCallStreamEvents

func TestToolCallStreamEvents(t testing.TB, client chat.Client)

TestToolCallStreamEvents tests that tool call events are emitted during streaming

func TestToolsSummarizesFile

func TestToolsSummarizesFile(t testing.TB, client chat.Client)

TestToolsSummarizesFile tests tool calling functionality with filesystem tools

func TestWritesFile

func TestWritesFile(t testing.TB, client chat.Client)

TestWritesFile tests that context is properly passed through tool calls

Types

type BaseURLValidator

type BaseURLValidator interface {
	BaseURL() string
}

BaseURLValidator is an interface that clients can implement to expose their base URL for testing

type HeadersValidator

type HeadersValidator interface {
	Headers() map[string]string
}

HeadersValidator is an interface that clients can implement to expose their custom headers for testing

type IntegrationConfig

type IntegrationConfig struct {
	Provider    string // "openai", "claude", "gemini"
	APIKey      string // from environment
	Model       string // defaults to cheapest model
	SkipIfNoKey bool   // skip test if API key missing
}

IntegrationConfig holds configuration for integration tests

Jump to

Keyboard shortcuts

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