testutil

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertJSONKey

func AssertJSONKey(t *testing.T, body []byte, key, want string)

AssertJSONKey fails if the JSON body doesn't contain key with the expected string value.

func AssertStatus

func AssertStatus(t *testing.T, got, want int)

AssertStatus fails if got != want.

func DoRequest

func DoRequest(handler http.Handler, method, path string) *httptest.ResponseRecorder

DoRequest performs an HTTP request against the handler and returns the recorder.

func NewTestDB

func NewTestDB(t *testing.T, models ...interface{}) *gorm.DB

NewTestDB opens an in-memory SQLite database and auto-migrates any provided models.

func NewTestRouter

func NewTestRouter(t *testing.T) *router.Router

NewTestRouter creates a Router in Gin test mode.

Types

This section is empty.

Jump to

Keyboard shortcuts

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