authorizer/server/test/signup_test.go

30 lines
734 B
Go
Raw Normal View History

2021-12-22 10:01:45 +00:00
package test
import (
"context"
"log"
"net/http/httptest"
"testing"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/resolvers"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
func TestSQLSignUp(t *testing.T) {
w := httptest.NewRecorder()
req := httptest.NewRequest("POST", "/graphql", nil)
c, _ := gin.CreateTestContext(w)
ctx := context.WithValue(req.Context(), "GinContextKey", c)
res, err := resolvers.Signup(ctx, model.SignUpInput{
Email: "test@yopmail.com",
Password: "test",
ConfirmPassword: "test",
})
log.Println("=> signup err:", err)
log.Println("=> singup res:", res)
assert.Equal(t, "success", "success")
}