Documentation
¶
Index ¶
- type TestApplication
- func Default(settings ...settings.Config) *TestApplication[struct{}]
- func DefaultWithAuth[AuthModel any](authFunc simba.AuthFunc[AuthModel], settings ...settings.Config) *TestApplication[AuthModel]
- func New(settings ...settings.Config) *TestApplication[struct{}]
- func NewWithAuth[AuthModel any](authFunc simba.AuthFunc[AuthModel], settings ...settings.Config) *TestApplication[AuthModel]
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 }
TestApplication represents a test application with additional testing utilities
func Default ¶ added in v0.10.0
func Default(settings ...settings.Config) *TestApplication[struct{}]
Default creates a new test application with default settings
func DefaultWithAuth ¶ added in v0.10.0
func DefaultWithAuth[AuthModel any](authFunc simba.AuthFunc[AuthModel], settings ...settings.Config) *TestApplication[AuthModel]
DefaultWithAuth creates a new test application with default settings and with authentication
func New ¶
func New(settings ...settings.Config) *TestApplication[struct{}]
New creates a new test application with the given settings
func NewWithAuth ¶ added in v0.10.0
func NewWithAuth[AuthModel any](authFunc simba.AuthFunc[AuthModel], settings ...settings.Config) *TestApplication[AuthModel]
NewWithAuth creates a new test application with the given settings and with authentication
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