From 6145c7ef795811cbcfd3f9194c95abb24a211205 Mon Sep 17 00:00:00 2001 From: Xeronith Date: Sat, 10 Sep 2022 15:10:09 +0430 Subject: [PATCH] test(app): :white_check_mark: add profile test --- greataped/tests/profile_test.go | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 greataped/tests/profile_test.go diff --git a/greataped/tests/profile_test.go b/greataped/tests/profile_test.go new file mode 100644 index 0000000..eaca358 --- /dev/null +++ b/greataped/tests/profile_test.go @@ -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() + } +}