Documentation
¶
Overview ¶
Package testutil provides testing utilities and helpers.
Index ¶
- func AssertContains(t *testing.T, s, substr, msg string)
- func AssertEqual(t *testing.T, expected, actual interface{}, msg string)
- func AssertError(t *testing.T, err error, msg string)
- func AssertFalse(t *testing.T, value bool, msg string)
- func AssertJSONContains(t *testing.T, body []byte, key string, expected interface{})
- func AssertNil(t *testing.T, value interface{}, msg string)
- func AssertNoError(t *testing.T, err error, msg string)
- func AssertNotEqual(t *testing.T, notExpected, actual interface{}, msg string)
- func AssertNotNil(t *testing.T, value interface{}, msg string)
- func AssertStatusCode(t *testing.T, rr *httptest.ResponseRecorder, expected int)
- func AssertTrue(t *testing.T, value bool, msg string)
- func NewTestRequest(method, path string, body io.Reader) *http.Request
- func NewTestRequestWithJSON(t *testing.T, method, path string, data interface{}) *http.Request
- func ParseJSONResponse(t *testing.T, body []byte) map[string]interface{}
- func RandomEmail() string
- func RandomUUID() uuid.UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContains ¶
AssertContains fails the test if s does not contain substr.
func AssertEqual ¶
AssertEqual compares two values and fails the test if they're not equal.
func AssertError ¶
AssertError fails the test if err is nil.
func AssertFalse ¶
AssertFalse fails the test if the value is not false.
func AssertJSONContains ¶
AssertJSONContains checks if the JSON response contains expected key-value pairs.
func AssertNoError ¶
AssertNoError fails the test if err is not nil.
func AssertNotEqual ¶
AssertNotEqual compares two values and fails the test if they're equal.
func AssertNotNil ¶
AssertNotNil fails the test if the value is nil.
func AssertStatusCode ¶
func AssertStatusCode(t *testing.T, rr *httptest.ResponseRecorder, expected int)
AssertStatusCode checks if the response has the expected status code.
func AssertTrue ¶
AssertTrue fails the test if the value is not true.
func NewTestRequest ¶
NewTestRequest creates a new HTTP request for testing.
func NewTestRequestWithJSON ¶
NewTestRequestWithJSON creates a new HTTP request with JSON body.
func ParseJSONResponse ¶
ParseJSONResponse parses a JSON response body into a map.
Types ¶
This section is empty.