Documentation
¶
Index ¶
- func AssertErrorResponse(t *testing.T, body []byte, expectedMessage string)
- func AssertHTTPStatusCode(t *testing.T, got, want int)
- func CreateHealthRecordJSON(t *testing.T, date time.Time, stepCount int) string
- func CreateRequestContext(ctx context.Context, method, url, body string) *http.Request
- func ExecuteHandlerRequest(t *testing.T, handler http.HandlerFunc, req *http.Request) *httptest.ResponseRecorder
- func ParseAPIDateFormat(dateStr string) time.Time
- func ParseJSONResponse(t *testing.T, body []byte, target any)
- func SetupMockDBWithRecords(t *testing.T, records []models.HealthRecord) *mock.MockDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertErrorResponse ¶
AssertErrorResponse checks if the error response contains the expected message
func AssertHTTPStatusCode ¶
AssertHTTPStatusCode checks if the status code is as expected
func CreateHealthRecordJSON ¶
CreateHealthRecordJSON creates a JSON representation of a health record
func CreateRequestContext ¶
CreateRequestContext creates an HTTP request with JSON content type for testing
func ExecuteHandlerRequest ¶
func ExecuteHandlerRequest(t *testing.T, handler http.HandlerFunc, req *http.Request) *httptest.ResponseRecorder
ExecuteHandlerRequest executes a handler with the given request and returns the response
func ParseAPIDateFormat ¶
ParseAPIDateFormat parses the date string(YYYY-MM-DD) from API request
func ParseJSONResponse ¶
ParseJSONResponse parses a JSON response body into the given target
func SetupMockDBWithRecords ¶
SetupMockDBWithRecords sets up a mock DB with the given records func SetupMockDBWithRecords(t *testing.T, records ...*models.HealthRecord) *mock.MockDB {
Types ¶
This section is empty.