Update contributing test doc
This commit is contained in:
parent
f5aeda1283
commit
75affcbf30
77
.github/CONTRIBUTING.md
vendored
77
.github/CONTRIBUTING.md
vendored
|
@ -60,33 +60,39 @@ Setup mongodb & arangodb using Docker
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run --name mongodb -d -p 27017:27017 mongo
|
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)
|
> 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,
|
If you are adding new resolver,
|
||||||
|
|
||||||
1. create new resolver test file [here](https://github.com/authorizerdev/authorizer/tree/main/server/__test__)
|
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)`
|
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)
|
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
|
```sh
|
||||||
make test
|
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
|
For manually testing using graphql playground, you can paste following queries and mutations in your playground and test it
|
||||||
|
|
||||||
```gql
|
```gql
|
||||||
mutation Signup {
|
mutation Signup {
|
||||||
signup(params: {
|
signup(
|
||||||
email: "lakhan@yopmail.com",
|
params: {
|
||||||
password: "test",
|
email: "lakhan@yopmail.com"
|
||||||
confirm_password: "test",
|
password: "test"
|
||||||
|
confirm_password: "test"
|
||||||
given_name: "lakhan"
|
given_name: "lakhan"
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
message
|
message
|
||||||
user {
|
user {
|
||||||
id
|
id
|
||||||
|
@ -99,10 +105,9 @@ mutation Signup {
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation ResendEamil {
|
mutation ResendEamil {
|
||||||
resend_verify_email(params: {
|
resend_verify_email(
|
||||||
email: "lakhan@yopmail.com"
|
params: { email: "lakhan@yopmail.com", identifier: "basic_auth_signup" }
|
||||||
identifier: "basic_auth_signup"
|
) {
|
||||||
}) {
|
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,9 +122,7 @@ query GetVerifyRequests {
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation VerifyEmail {
|
mutation VerifyEmail {
|
||||||
verify_email(params: {
|
verify_email(params: { token: "" }) {
|
||||||
token: ""
|
|
||||||
}) {
|
|
||||||
access_token
|
access_token
|
||||||
expires_at
|
expires_at
|
||||||
user {
|
user {
|
||||||
|
@ -132,10 +135,7 @@ mutation VerifyEmail {
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation Login {
|
mutation Login {
|
||||||
login(params: {
|
login(params: { email: "lakhan@yopmail.com", password: "test" }) {
|
||||||
email: "lakhan@yopmail.com",
|
|
||||||
password: "test"
|
|
||||||
}) {
|
|
||||||
access_token
|
access_token
|
||||||
expires_at
|
expires_at
|
||||||
user {
|
user {
|
||||||
|
@ -165,27 +165,21 @@ query GetSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation ForgotPassword {
|
mutation ForgotPassword {
|
||||||
forgot_password(params: {
|
forgot_password(params: { email: "lakhan@yopmail.com" }) {
|
||||||
email: "lakhan@yopmail.com"
|
|
||||||
}) {
|
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation ResetPassword {
|
mutation ResetPassword {
|
||||||
reset_password(params: {
|
reset_password(
|
||||||
token: ""
|
params: { token: "", password: "test", confirm_password: "test" }
|
||||||
password: "test"
|
) {
|
||||||
confirm_password: "test"
|
|
||||||
}) {
|
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation UpdateProfile {
|
mutation UpdateProfile {
|
||||||
update_profile(params: {
|
update_profile(params: { family_name: "samani" }) {
|
||||||
family_name: "samani"
|
|
||||||
}) {
|
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,9 +198,7 @@ query GetUsers {
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation MagicLinkLogin {
|
mutation MagicLinkLogin {
|
||||||
magic_link_login(params: {
|
magic_link_login(params: { email: "test@yopmail.com" }) {
|
||||||
email: "test@yopmail.com"
|
|
||||||
}) {
|
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,24 +209,21 @@ mutation Logout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation UpdateUser{
|
mutation UpdateUser {
|
||||||
_update_user(params: {
|
_update_user(
|
||||||
id: "dafc9400-d603-4ade-997c-83fcd54bbd67",
|
params: {
|
||||||
|
id: "dafc9400-d603-4ade-997c-83fcd54bbd67"
|
||||||
roles: ["user", "admin"]
|
roles: ["user", "admin"]
|
||||||
}) {
|
}
|
||||||
|
) {
|
||||||
email
|
email
|
||||||
roles
|
roles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutation DeleteUser {
|
mutation DeleteUser {
|
||||||
_delete_user(params: {
|
_delete_user(params: { email: "signup.test134523@yopmail.com" }) {
|
||||||
email: "signup.test134523@yopmail.com"
|
|
||||||
}) {
|
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user