I apologize if this is obvious, but I'm having trouble figuring it out.
What is the best way to write controller tests for an end point protected by hapi-auth-cookie?
I'm doing something like this in my controller test:
let response = await server.inject(request);
should.equal(response.statusCode, 200);
However, request.url is protected by hapi-auth-cookie, so I get a 302 redirect code because it (correctly) wants me to log in.
What's the best way to fake a login so server.inject works as expected?
I apologize if this is obvious, but I'm having trouble figuring it out.
What is the best way to write controller tests for an end point protected by hapi-auth-cookie?
I'm doing something like this in my controller test:
However, request.url is protected by hapi-auth-cookie, so I get a 302 redirect code because it (correctly) wants me to log in.
What's the best way to fake a login so server.inject works as expected?