testutil

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

internal/testutil/testutil.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONResponse

func JSONResponse(w http.ResponseWriter, status int, body string)

JSONResponse is a helper to write JSON responses in tests.

func NewMockServer

func NewMockServer(t *testing.T, handler http.HandlerFunc) *httptest.Server

NewMockServer creates a test HTTP server with the given handler. The server is automatically closed when the test completes.

func NewMockServerWithRoutes

func NewMockServerWithRoutes(t *testing.T, routes map[string]http.HandlerFunc) *httptest.Server

NewMockServerWithRoutes creates a test server with multiple route handlers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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