forked from fr/deguapp
Added: signin api
This commit is contained in:
parent
3227854086
commit
09c30d28d4
@ -10,6 +10,7 @@ const router = Router();
|
|||||||
//const mws = [requireAuth, handleValidation.handleValidationError];
|
//const mws = [requireAuth, handleValidation.handleValidationError];
|
||||||
|
|
||||||
router.post("/auth/signup",validate(AuthVal.signup) , authController.signup_post);
|
router.post("/auth/signup",validate(AuthVal.signup) , authController.signup_post);
|
||||||
|
router.post("/auth/signin",validate(AuthVal.signin) , authController.signin_post);
|
||||||
|
|
||||||
//router.post(
|
//router.post(
|
||||||
// "/login",
|
// "/login",
|
||||||
|
@ -172,7 +172,10 @@ describe('POST /api/v1/auth/signin', () => {
|
|||||||
email: 'thisistest@host.local',
|
email: 'thisistest@host.local',
|
||||||
password: 'Test12365465132'
|
password: 'Test12365465132'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(res.statusCode).toBe(401);
|
expect(res.statusCode).toBe(401);
|
||||||
|
expect(res.header['set-cookie'][0]).toContain("jwt=; Max-Age=0")
|
||||||
|
expect(res.header['set-cookie'][1]).toContain("auth=false")
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should login an user', async () => {
|
test('should login an user', async () => {
|
||||||
@ -182,6 +185,8 @@ describe('POST /api/v1/auth/signin', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(res.statusCode).toBe(200);
|
expect(res.statusCode).toBe(200);
|
||||||
|
expect(res.header['set-cookie'][0]).toContain("jwt=")
|
||||||
|
expect(res.header['set-cookie'][1]).toContain("auth=true")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user