First failing test in control package
This commit is contained in:
@@ -1,9 +1,27 @@
|
||||
package control_test
|
||||
package control
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) {
|
||||
func TestAppendNerRouteFromRequest(t *testing.T) {
|
||||
reqPayload := "{}"
|
||||
|
||||
req := httptest.NewRequest(http.MethodPost, "/routes", strings.NewReader(reqPayload))
|
||||
resp := httptest.NewRecorder()
|
||||
|
||||
handler := http.HandlerFunc(addRoute)
|
||||
|
||||
handler.ServeHTTP(resp, req)
|
||||
if resp.Code != http.StatusCreated {
|
||||
t.Errorf("HTTP status mistmacht. Expected: %d, got: %d", http.StatusCreated, resp.Code)
|
||||
}
|
||||
|
||||
expectedPayload := "{}"
|
||||
if resp.Body.String() != expectedPayload {
|
||||
t.Errorf("HTTP status mistmacht. Expected: %d, got: %d", http.StatusCreated, resp.Code)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user