Documentation
¶
Index ¶
- func AssertError(t *testing.T, err error)
- func AssertErrorResponse(t *testing.T, rec *httptest.ResponseRecorder, expectedStatus int, ...)
- func AssertJSONResponse(t *testing.T, rec *httptest.ResponseRecorder, expectedStatus int)
- func AssertNoError(t *testing.T, err error)
- func AssertResponseBody(t *testing.T, rec *httptest.ResponseRecorder, expected any)
- func AssertResponseCode(t *testing.T, rec *httptest.ResponseRecorder, expectedCode int)
- func AssertResponseHeader(t *testing.T, rec *httptest.ResponseRecorder, key, expectedValue string)
- func AssertSuccessResponse(t *testing.T, rec *httptest.ResponseRecorder, expectedStatus int)
- func NewJSONRequest(method, path string, body any) (*http.Request, error)
- func NewTestContext(e *echo.Echo, req *http.Request) (echo.Context, *httptest.ResponseRecorder)
- func ParseJSONResponse(rec *httptest.ResponseRecorder, v any) error
- type TestSetup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertError ¶
AssertError checks if an error occurred
func AssertErrorResponse ¶
func AssertErrorResponse(t *testing.T, rec *httptest.ResponseRecorder, expectedStatus int, expectedError string)
AssertErrorResponse asserts error response properties
func AssertJSONResponse ¶
func AssertJSONResponse(t *testing.T, rec *httptest.ResponseRecorder, expectedStatus int)
AssertJSONResponse asserts common JSON response properties
func AssertNoError ¶
AssertNoError checks if no error occurred
func AssertResponseBody ¶
func AssertResponseBody(t *testing.T, rec *httptest.ResponseRecorder, expected any)
AssertResponseBody asserts that the response body matches the expected value
func AssertResponseCode ¶
func AssertResponseCode(t *testing.T, rec *httptest.ResponseRecorder, expectedCode int)
AssertResponseCode checks if the response has the expected status code
func AssertResponseHeader ¶
func AssertResponseHeader(t *testing.T, rec *httptest.ResponseRecorder, key, expectedValue string)
AssertResponseHeader checks if the response has the expected header value
func AssertSuccessResponse ¶
func AssertSuccessResponse(t *testing.T, rec *httptest.ResponseRecorder, expectedStatus int)
AssertSuccessResponse asserts success response properties
func NewJSONRequest ¶
NewJSONRequest creates a new JSON request for testing
func NewTestContext ¶
NewTestContext creates a new Echo context for testing
func ParseJSONResponse ¶
func ParseJSONResponse(rec *httptest.ResponseRecorder, v any) error
ParseJSONResponse parses a JSON response from a test recorder
Types ¶
type TestSetup ¶
TestSetup contains common test setup utilities
func NewTestSetup ¶
NewTestSetup creates a new test setup with common configurations
func (*TestSetup) AssertNoError ¶
AssertNoError asserts that the given error is nil
func (*TestSetup) RequireNoError ¶
RequireNoError requires that the given error is nil