Help us shape the future of Go! Take the 2026 Go Developer Survey

simbaTest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestApplication

type TestApplication[AuthModel any] struct {
	*simba.Application[AuthModel]
	Server *httptest.Server
	T      *testing.T
}

TestApplication represents a test application with additional testing utilities

func New

func New[AuthModel any](t *testing.T, authFunc simba.AuthFunc[AuthModel], settings ...settings.Settings) *TestApplication[AuthModel]

New creates a new test application with the given settings

func (*TestApplication[AuthModel]) Client

func (a *TestApplication[AuthModel]) Client() *http.Client

Client returns an HTTP client configured to work with the test server

func (*TestApplication[AuthModel]) RunTest

func (a *TestApplication[AuthModel]) RunTest(fn func())

RunTest runs a test function with a started test server and handles cleanup

func (*TestApplication[AuthModel]) Start

func (a *TestApplication[AuthModel]) Start()

Start starts the test server

func (*TestApplication[AuthModel]) Stop

func (a *TestApplication[AuthModel]) Stop()

Stop stops the test server

func (*TestApplication[AuthModel]) URL

func (a *TestApplication[AuthModel]) URL() string

URL returns the base URL of the test server

Jump to

Keyboard shortcuts

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