2018-12-21 11:50:28 +00:00
|
|
|
const app = require(`${serviceRoot}/server/server`);
|
2018-08-14 10:48:12 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
});
|