testutil

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTestDotEnv

func LoadTestDotEnv(t *testing.T)

LoadTestDotEnv loads .env.test from the project root into the process environment. It is safe to call multiple times — the file is only read once. Existing env vars are never overridden.

func RequireAPIKey

func RequireAPIKey(t *testing.T, envVar string) string

RequireAPIKey skips the test if the named environment variable is not set or is empty. Use this for tests that need real API keys from .env.

Example:

func TestLiveChat(t *testing.T) {
    key := testutil.RequireAPIKey(t, "OPENROUTER_API_KEY")
    // ... use key
}

func RequireAnyAPIKey

func RequireAnyAPIKey(t *testing.T, envVars ...string) string

RequireAnyAPIKey skips the test unless at least one of the named env vars is set. Returns the value of the first one found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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