Permissions authorization middleware.

This commit is contained in:
Ahmed Bouhuolia
2019-09-16 01:08:19 +02:00
parent ed4d37c8fb
commit de905d7e7c
23 changed files with 318 additions and 51 deletions

View File

@@ -85,14 +85,14 @@ describe('routes: /auth/', () => {
});
it('Should autheticate success with correct phone number and password.', async () => {
const password = hashPassword('admin');
const password = await hashPassword('admin');
const user = await create('user', {
phone_number: '0920000000',
password,
});
const res = await request().post('/api/auth/login').send({
crediential: user.phone_number,
password,
crediential: user.email,
password: 'admin',
});
expect(res.status).equals(200);