test(app): add profile test

master
Xeronith 2022-09-10 15:10:09 +04:30
rodzic 5e1023110b
commit 6145c7ef79
1 zmienionych plików z 35 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,35 @@
package tests
import (
"fmt"
"net/http"
"testing"
"github.com/google/uuid"
)
func TestProfile(t *testing.T) {
id := uuid.New().String()
resp, err := Post("/api/v1/signup", Payload{
"email": fmt.Sprintf("%s@%s", id, DOMAIN),
"password": "123456",
"username": id,
})
if err != nil {
t.Fatal(err)
}
if resp.StatusCode != http.StatusOK {
t.FailNow()
}
resp, err = Get(fmt.Sprintf("/u/%s", id))
if err != nil {
t.Fatal(err)
}
if resp.StatusCode != http.StatusOK {
t.FailNow()
}
}