Micro-service for file storage and processing written in Go
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package main
import ( "net/http" "net/http/httptest" "testing"
"github.com/stretchr/testify/assert" )
func TestIndexRoute(t *testing.T) { t.Run("Index route returns valid response", func(t *testing.T) { request := httptest.NewRequest(http.MethodGet, "/", nil) responseRecorder := httptest.NewRecorder()
IndexHandler(responseRecorder, request)
assert.Equal(t, responseRecorder.Code, 200, "Response code should be 200") assert.NotNil(t, responseRecorder.Body, "Response should contain body") }) }
|