2021-12-23 08:47:44 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/authorizerdev/authorizer/server/constants"
|
|
|
|
"github.com/authorizerdev/authorizer/server/db"
|
|
|
|
"github.com/authorizerdev/authorizer/server/enum"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestResolvers(t *testing.T) {
|
|
|
|
databases := map[string]string{
|
2021-12-30 04:31:51 +00:00
|
|
|
enum.Sqlite.String(): "../../data.db",
|
|
|
|
// enum.Arangodb.String(): "http://root:root@localhost:8529",
|
|
|
|
// enum.Mongodb.String(): "mongodb://localhost:27017",
|
2021-12-23 08:47:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for dbType, dbURL := range databases {
|
|
|
|
constants.DATABASE_URL = dbURL
|
|
|
|
constants.DATABASE_TYPE = dbType
|
|
|
|
db.InitDB()
|
2021-12-24 00:57:39 +00:00
|
|
|
|
2021-12-23 08:47:44 +00:00
|
|
|
s := testSetup()
|
|
|
|
defer s.Server.Close()
|
2021-12-24 00:57:39 +00:00
|
|
|
|
|
|
|
t.Run("should pass tests for "+dbType, func(t *testing.T) {
|
2021-12-23 08:47:44 +00:00
|
|
|
loginTests(s, t)
|
|
|
|
signupTests(s, t)
|
|
|
|
forgotPasswordTest(s, t)
|
|
|
|
resendVerifyEmailTests(s, t)
|
|
|
|
resetPasswordTest(s, t)
|
|
|
|
verifyEmailTest(s, t)
|
2021-12-24 00:57:39 +00:00
|
|
|
sessionTests(s, t)
|
|
|
|
profileTests(s, t)
|
|
|
|
updateProfileTests(s, t)
|
|
|
|
magicLinkLoginTests(s, t)
|
|
|
|
logoutTests(s, t)
|
|
|
|
metaTests(s, t)
|
|
|
|
|
|
|
|
// admin tests
|
|
|
|
verificationRequestsTest(s, t)
|
|
|
|
usersTest(s, t)
|
|
|
|
deleteUserTest(s, t)
|
|
|
|
updateUserTest(s, t)
|
2021-12-30 04:31:51 +00:00
|
|
|
aminLoginTests(s, t)
|
2021-12-23 08:47:44 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|