const app = require('vn-loopback/server/server'); describe('sale updatePrice()', () => { it('should throw an error if the price is not a number', async() => { let error; let params = {price: `this price is so wrong!`}; await app.models.Sale.updatePrice(params) .catch(response => { expect(response).toEqual(new Error('The value should be a number')); error = response; }); expect(error).toBeDefined(); }); it(`should throw an error if the price is undefined`, async() => { let error; let params = {ticketFk: 1, price: undefined}; await app.models.Sale.updatePrice(params) .catch(response => { expect(response).toEqual(new Error('The value should be a number')); error = response; }); expect(error).toBeDefined(); }); });