kopia lustrzana https://github.com/reiver/greatape
test(app): ♻️ isolate and refine tests
rodzic
ae3abf5723
commit
0ea6d410fe
|
@ -17,6 +17,8 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
type Payload map[string]interface{}
|
||||
|
||||
const (
|
||||
DOMAIN = "domain.social"
|
||||
ROOT = "http://localhost"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"app/models/types"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
@ -11,12 +10,11 @@ import (
|
|||
|
||||
func TestLogin(t *testing.T) {
|
||||
id := uuid.New().String()
|
||||
payload := types.LoginDTO{
|
||||
Email: fmt.Sprintf("%s@%s", id, DOMAIN),
|
||||
Password: "123456",
|
||||
}
|
||||
|
||||
resp, err := Post("/api/v1/login", payload)
|
||||
resp, err := Post("/api/v1/login", Payload{
|
||||
"email": fmt.Sprintf("%s@%s", id, DOMAIN),
|
||||
"password": "123456",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"app/models/types"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
@ -11,15 +10,12 @@ import (
|
|||
|
||||
func TestSignup(t *testing.T) {
|
||||
id := uuid.New().String()
|
||||
payload := types.SignupDTO{
|
||||
LoginDTO: types.LoginDTO{
|
||||
Email: fmt.Sprintf("%s@%s", id, DOMAIN),
|
||||
Password: "123456",
|
||||
},
|
||||
Username: id,
|
||||
}
|
||||
|
||||
resp, err := Post("/api/v1/signup", payload)
|
||||
resp, err := Post("/api/v1/signup", Payload{
|
||||
"email": fmt.Sprintf("%s@%s", id, DOMAIN),
|
||||
"password": "123456",
|
||||
"username": id,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue