Closed alexandr2110pro closed 4 years ago
@kamilmysliwiec
In apollo docs here
they say that
... createTestClient provides a single hook to run operations through the request pipeline, enabling the most thorough tests possible without starting up an HTTP server.
Does it mean that I can't test auth done with http cookies/headers this way?
Does anyone know the best way to test graphql api with auth?
Just found a related discussion
https://github.com/apollographql/apollo-server/issues/2277
So it is not related to nestjs. But still, how do you guys do integration tests for your graphql apis?
It's not related to NestJS specifically.
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
Hi. I have troubles testing auth with @nestjs/graphl and apollo-server-testing.
I'm creating my apollo test client as:
then I have a guard, where I'm using the
req
object from the context.And in the compiled app it works, but when I'm running the test for it, both
req
andres
areundefined
I'd really appreciate if you can point out how to make it work.
Expected behavior
req and res object should be available in the ContextFunction
Minimal reproduction of the problem with instructions
Configure the GraphQLModule and the testClient as shown in the snippet and run tests.
What is the motivation / use case for changing the behavior?
Environment