does anyone knows the best way to unit test graphc...
# prisma-whats-new
j
does anyone knows the best way to unit test graphcool-framework custom resolvers?
l
I think the possible solution will be seeding the database with data and creating testing environment with postman + newman. I don’t think it’s the best solution out there to be honest
I’m using postman and newman, which are working pretty sweet, but not for unit testing, more like integration tests
j
I see
never heard of newman before, going to take a look
oh basically the cli of postman
l
it’s a postman cli basically
j
yeah lol
l
Yep 😄
j
🤔 I think this could work
l
I’m working with it and I think that in the end it’s pretty convenient (especially with environment and collections in the cloud), but like I said, someone may recommend you a better solution
j
thanks!
hey @Lotafak do you know the syntax of the
body
in the
request
area of newman to do a request to graphcool?
I'm getting
the request content was malformed
l
Sec
Are you asking what’s in the newman’s collection file or what is in body of postman?
This is what is in postman’s request body:
Copy code
{
  "query": "mutation Signup($email: String!, $password: String!, $firstName: String!, $lastName: String!) {signup(email: $email, password:$password, firstName: $firstName, lastName: $lastName){id}}",
  "variables": {
    "email": "{{email}}",
    "password": "{{password}}",
    "firstName": "{{firstName}}",
    "lastName": "{{lastName}}"
  }
}
j
I have this in
"body": {"query":"mutation{findOrCreateUserByName(name:\"Nathan\"){id action}}"}
🤔
l
Copy code
"body": {
							"mode": "raw",
							"raw": "{\"query\": \"mutation Signup($email: String!, $password: String!, $firstName: String!, $lastName: String!) {signup(email: $email, password:$password, firstName: $firstName, lastName: $lastName){id}}\", \"variables\": { \"email\": \"{{email}}\", \"password\": \"{{password}}\", \"firstName\": \"{{firstName}}\", \"lastName\": \"{{lastName}}\" }}"
						},
I suggest you to use postman and then export your collection to a file and let newman read it if you’re not doing it right now
j
alright, thank you again! 😅
l
No problem at all 😉 Good luck