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

13 lines
422 B
JavaScript

const {models} = require('vn-loopback/server/server');
describe('account changePassword()', () => {
it('should throw an error when old password is wrong', async() => {
let err;
await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999')
.catch(error => err = error.sqlMessage);
expect(err).toBeDefined();
expect(err).toEqual('Invalid password');
});
});