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'); }); });