Documentation
¶
Index ¶
- func AssertJSON(t *testing.T, expected, actual any)
- func AssertStatusCode(t *testing.T, expected int, resp *httptest.ResponseRecorder)
- func DecodeJSON(t *testing.T, resp *httptest.ResponseRecorder, v any)
- func RunTableTests[I, O any](t *testing.T, tests []TableTest, fn func(I) (O, error))
- type TableTest
- type TestServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertJSON ¶
AssertJSON asserts that two JSON values are equal.
func AssertStatusCode ¶
func AssertStatusCode(t *testing.T, expected int, resp *httptest.ResponseRecorder)
AssertStatusCode asserts that the response has the expected status code.
func DecodeJSON ¶
func DecodeJSON(t *testing.T, resp *httptest.ResponseRecorder, v any)
DecodeJSON decodes JSON from a response body.
Types ¶
type TestServer ¶
TestServer wraps httptest.Server with additional utilities.
func NewTestServer ¶
func NewTestServer(t *testing.T, handler http.Handler) *TestServer
NewTestServer creates a new test server.
func (*TestServer) Request ¶
func (ts *TestServer) Request(method, path string, body any) *httptest.ResponseRecorder
Request sends an HTTP request to the test server.
Click to show internal directories.
Click to hide internal directories.