testutil

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempConfig

func CreateTempConfig(t *testing.T, sessionKey string) string

CreateTempConfig creates a temporary config file for testing Returns the path to the config file

func JSONEncode

func JSONEncode(data any) ([]byte, error)

JSONEncode encodes data to JSON bytes

func JSONResponse

func JSONResponse(w http.ResponseWriter, status int, data any)

JSONResponse writes a JSON response with the given status code

func NewTestServer

func NewTestServer(handler http.HandlerFunc) *httptest.Server

NewTestServer creates a test HTTP server with the given handler

func SampleBundle

func SampleBundle(gamekey string) models.Bundle

SampleBundle creates a fully populated sample bundle for testing

func SampleGameKeys

func SampleGameKeys(count int) []string

SampleGameKeys generates N sample game keys for testing

func SampleProduct

func SampleProduct(name string) models.Product

SampleProduct creates a sample product for testing

func SetTestHomeDir

func SetTestHomeDir(t *testing.T, homeDir string)

SetTestHomeDir sets the HOME environment variable for testing This allows tests to control where config files are read/written

Types

This section is empty.

Jump to

Keyboard shortcuts

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