test: add handler and config tests (auth, tasks, habits, savings, profile, interest, freeze)
Some checks failed
CI / lint-test (push) Failing after 1s
Some checks failed
CI / lint-test (push) Failing after 1s
This commit is contained in:
20
internal/handler/profile_test.go
Normal file
20
internal/handler/profile_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestProfileHandler_Update_InvalidBody(t *testing.T) {
|
||||
req := httptest.NewRequest("PUT", "/profile", bytes.NewBufferString("not json"))
|
||||
rr := httptest.NewRecorder()
|
||||
|
||||
h := &ProfileHandler{userRepo: nil}
|
||||
h.Update(rr, req)
|
||||
|
||||
if rr.Code != http.StatusBadRequest {
|
||||
t.Errorf("expected 400, got %d", rr.Code)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user