salix/back/methods/account/specs/change-password.spec.js

13 lines
430 B
JavaScript
Raw Normal View History

2022-05-13 08:52:05 +00:00
const {models} = require('vn-loopback/server/server');
2022-05-13 09:52:49 +00:00
fdescribe('account changePassword()', () => {
it('should throw an error when old password is wrong', async() => {
2022-05-13 09:31:18 +00:00
let err;
await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999')
2022-05-13 08:59:13 +00:00
.catch(error => err = error.sqlMessage);
2022-05-13 09:31:18 +00:00
expect(err).toBeDefined();
expect(err).toEqual('Invalid password');
2022-05-13 09:57:36 +00:00
}, 40000);
});