modelsdevtest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package modelsdevtest provides shared models.dev test doubles: fixture providers and the httptest servers that serve them, so library and CLI tests exercise the same deterministic, network-free models.dev.

Index

Constants

This section is empty.

Variables

View Source
var ReleaseDates = map[string]string{
	"anthropic": "2025-06-01",
	"google":    "2024-01-01",
	"openai":    "2025-01-01",
}

ReleaseDates gives each fixture provider's model a distinct release date so newest-first ordering is observable across providers.

Functions

func CatalogJSON

func CatalogJSON(present, malformed []string) []byte

CatalogJSON is the fixture catalog bytes: present providers valid, malformed fail validation. Used when a test needs raw bytes rather than a live server.

func Closed

func Closed(t *testing.T) string

URL of a server that is already shut down so a fetch fails.

func CountingServer

func CountingServer(t *testing.T, present []string) (*httptest.Server, *atomic.Int64)

CountingServer is Server with a fetch counter so a test can assert a single operation fetches models.dev once however many goroutines it fans out.

func MustNotFetch

func MustNotFetch(t *testing.T) string

MustNotFetch returns a models.dev URL whose any access fails the test: proof that a code path stays offline.

func Provider

func Provider(pid string, malformed bool) modelsdev.Provider

Provider builds one fixture provider with a single model. anthropic carries "claude-sonnet" so the canonical-id path resolves; others carry a generic model. A malformed provider's model has an empty id.

func Server

func Server(t *testing.T, present []string, malformed ...string) *httptest.Server

present: one valid model each; malformed: model that fails validation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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