Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FakeLogger ¶
type FakeLogger struct {
Entries []string
}
FakeLogger collects log entries for test assertions.
func (*FakeLogger) AssertLogged ¶
func (l *FakeLogger) AssertLogged(t *testing.T, msg string)
AssertLogged fails the test if msg was not logged.
type TestContext ¶
TestContext holds a context and variable map for test use.
func NewTestContext ¶
func NewTestContext() *TestContext
NewTestContext creates a TestContext with a background context.
type TestHost ¶
type TestHost struct {
Container *di.Container
Server *httptest.Server
Client *http.Client
// contains filtered or unexported fields
}
TestHost provides a DI container and test HTTP server.
func NewTestHost ¶
NewTestHost creates a TestHost with a DI container and test server.
func (*TestHost) Close ¶
func (h *TestHost) Close()
Close shuts down the test server and runs cleanup functions.
func (*TestHost) Get ¶
func (h *TestHost) Get(path string) *TestResponse
Get issues a GET request and returns a TestResponse.
type TestResponse ¶
TestResponse holds an HTTP response for test assertions.
func (*TestResponse) Decode ¶
func (r *TestResponse) Decode(v any) error
Decode unmarshals the response body into v.
func (*TestResponse) String ¶
func (r *TestResponse) String() string
String returns the response body as a string.
Click to show internal directories.
Click to hide internal directories.