Documentation
¶
Index ¶
- func CheckError(t *testing.T, err error, message string)
- func ContextWithTimeout(t *testing.T) (context.Context, context.CancelFunc)
- func MakeRequest(t *testing.T, router *gin.Engine, method, path string, body any, ...) *httptest.ResponseRecorder
- func ParseResponse(t *testing.T, resp *httptest.ResponseRecorder, dst interface{})
- func RequireHTTPStatus(t *testing.T, resp *httptest.ResponseRecorder, status int)
- func RequireJSONContentType(t *testing.T, resp *httptest.ResponseRecorder)
- func SetupTestRouter(t *testing.T) *gin.Engine
- func TestLogger(t *testing.T) *zap.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
CheckError verifica se um erro contém uma mensagem específica
func ContextWithTimeout ¶
ContextWithTimeout cria um contexto com timeout para testes
func MakeRequest ¶
func MakeRequest(t *testing.T, router *gin.Engine, method, path string, body any, headers map[string]string) *httptest.ResponseRecorder
MakeRequest executa uma requisição HTTP de teste
func ParseResponse ¶
func ParseResponse(t *testing.T, resp *httptest.ResponseRecorder, dst interface{})
ParseResponse analisa a resposta JSON para uma estrutura
func RequireHTTPStatus ¶
func RequireHTTPStatus(t *testing.T, resp *httptest.ResponseRecorder, status int)
RequireHTTPStatus verifica o status HTTP da resposta
func RequireJSONContentType ¶
func RequireJSONContentType(t *testing.T, resp *httptest.ResponseRecorder)
RequireJSONContentType verifica se o Content-Type da resposta é JSON
func SetupTestRouter ¶
SetupTestRouter configura um router Gin para testes
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.