Documentation
¶
Index ¶
- func CreateTempConfig(t *testing.T, sessionKey string) string
- func JSONEncode(data any) ([]byte, error)
- func JSONResponse(w http.ResponseWriter, status int, data any)
- func NewTestServer(handler http.HandlerFunc) *httptest.Server
- func SampleBundle(gamekey string) models.Bundle
- func SampleGameKeys(count int) []string
- func SampleProduct(name string) models.Product
- func SetTestHomeDir(t *testing.T, homeDir string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTempConfig ¶
CreateTempConfig creates a temporary config file for testing Returns the path to the config file
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 ¶
SampleBundle creates a fully populated sample bundle for testing
func SampleGameKeys ¶
SampleGameKeys generates N sample game keys for testing
func SampleProduct ¶
SampleProduct creates a sample product for testing
func SetTestHomeDir ¶
SetTestHomeDir sets the HOME environment variable for testing This allows tests to control where config files are read/written
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.