Update contributing test doc

This commit is contained in:
Lakhan Samani 2022-01-11 19:38:58 +05:30
parent f5aeda1283
commit 75affcbf30

View File

@ -60,33 +60,39 @@ Setup mongodb & arangodb using Docker
```
docker run --name mongodb -d -p 27017:27017 mongo
docker run --name arangodb -d -p 8529:8529 -e ARANGO_ROOT_PASSWORD=root arangodb/arangodb:3.8.4
// -e ARANGO_ROOT_PASSWORD=root
docker run --name arangodb -d -p 8529:8529 arangodb/arangodb:3.8.4
```
> Note: If you are not making any changes in db schema / db operations, you can disable those db tests [here](https://github.com/authorizerdev/authorizer/blob/main/server/__test__/resolvers_test.go#L14)
If you are adding new resolver,
1. create new resolver test file [here](https://github.com/authorizerdev/authorizer/tree/main/server/__test__)
Naming convention filename: `resolver_name_test.go` function name: `resolverNameTest(s TestSetup, t *testing.T)`
2. Add your tests [here](https://github.com/authorizerdev/authorizer/blob/main/server/__test__/resolvers_test.go#L38)
__Command to run tests:__
**Command to run tests:**
```sh
make test
```
__Manual Testing:__
**Manual Testing:**
For manually testing using graphql playground, you can paste following queries and mutations in your playground and test it
```gql
mutation Signup {
signup(params: {
email: "lakhan@yopmail.com",
password: "test",
confirm_password: "test",
signup(
params: {
email: "lakhan@yopmail.com"
password: "test"
confirm_password: "test"
given_name: "lakhan"
}) {
}
) {
message
user {
id
@ -99,10 +105,9 @@ mutation Signup {
}
mutation ResendEamil {
resend_verify_email(params: {
email: "lakhan@yopmail.com"
identifier: "basic_auth_signup"
}) {
resend_verify_email(
params: { email: "lakhan@yopmail.com", identifier: "basic_auth_signup" }
) {
message
}
}
@ -117,9 +122,7 @@ query GetVerifyRequests {
}
mutation VerifyEmail {
verify_email(params: {
token: ""
}) {
verify_email(params: { token: "" }) {
access_token
expires_at
user {
@ -132,10 +135,7 @@ mutation VerifyEmail {
}
mutation Login {
login(params: {
email: "lakhan@yopmail.com",
password: "test"
}) {
login(params: { email: "lakhan@yopmail.com", password: "test" }) {
access_token
expires_at
user {
@ -165,27 +165,21 @@ query GetSession {
}
mutation ForgotPassword {
forgot_password(params: {
email: "lakhan@yopmail.com"
}) {
forgot_password(params: { email: "lakhan@yopmail.com" }) {
message
}
}
mutation ResetPassword {
reset_password(params: {
token: ""
password: "test"
confirm_password: "test"
}) {
reset_password(
params: { token: "", password: "test", confirm_password: "test" }
) {
message
}
}
mutation UpdateProfile {
update_profile(params: {
family_name: "samani"
}) {
update_profile(params: { family_name: "samani" }) {
message
}
}
@ -204,9 +198,7 @@ query GetUsers {
}
mutation MagicLinkLogin {
magic_link_login(params: {
email: "test@yopmail.com"
}) {
magic_link_login(params: { email: "test@yopmail.com" }) {
message
}
}
@ -218,23 +210,20 @@ mutation Logout {
}
mutation UpdateUser {
_update_user(params: {
id: "dafc9400-d603-4ade-997c-83fcd54bbd67",
_update_user(
params: {
id: "dafc9400-d603-4ade-997c-83fcd54bbd67"
roles: ["user", "admin"]
}) {
}
) {
email
roles
}
}
mutation DeleteUser {
_delete_user(params: {
email: "signup.test134523@yopmail.com"
}) {
_delete_user(params: { email: "signup.test134523@yopmail.com" }) {
message
}
}
```