I'm have some issue in my test with superagent and express.js.
it('should 200 with valid login', (done) => {
console.log(createdUser[`${validUser.email}`]['token']);
// JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ODAwZDllZmNiM2VkMzBhOGZmMDUyOGUiLCJmaXJzdE5hbWUiOiJoYW5zIiwibGFzdE5hbWUiOiJvdHRvIiwiZW1haWwiOiJvdHRvQGV4YW1wbGUuZGUiLCJyb2xlIjoiVXNlciIsImlhdCI6MTQ3NjQ1MDc5OSwiZXhwIjoxNDc2NDYwODc5fQ.OlO_dVMCV6bm7XSyzKLFTgb-efOeyU1TniHEcIY7AHU
request(app)
.get('/api/protected')
.set('Authorization', createdUser[`${validUser.email}`]['token'])
.expect(200)
.end((err, res)=> {
if (err) done(err);
console.log(res.header);
// assert(true, 'asdfasdf');
// done();
});
});
I can't access to the protected path over superagent.
When I'm accessing the path over Postman it is working and I can access the protected path with the suited jwt.
What do have to change in the code? I want to test different paths.
thanks