#1719 claim.detail cambiar descuento falla

This commit is contained in:
Carlos Jimenez Ruiz 2019-09-26 09:05:18 +02:00
parent 1841e4edb0
commit 65981099b6
6 changed files with 45 additions and 6 deletions

View File

@ -309,7 +309,7 @@ export default {
ticketSummary: {
header: 'vn-ticket-summary > vn-card > div > h5',
state: 'vn-ticket-summary vn-label-value[label="State"] > section > span',
route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span',
route: 'vn-ticket-summary vn-label-value[label="Route"] > section > a',
total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong',
sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr',
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',

View File

@ -0,0 +1,39 @@
const app = require('vn-loopback/server/server');
describe('sale updateConcept()', () => {
const saleId = 1;
let originalSale;
beforeAll(async done => {
originalSale = await app.models.Sale.findById(saleId);
done();
});
afterAll(async done => {
await originalSale.save();
done();
});
it('should throw if ID was undefined', async() => {
const newConcept = 'I am he new concept';
await app.models.Sale.updateConcept(undefined, newConcept)
.catch(response => {
expect(response).toEqual(new Error(`Model::findById requiere el argumento id`));
error = response;
});
expect(error).toBeDefined();
});
it('should update the sale concept', async() => {
const newConcept = 'I am the new concept';
let response = await app.models.Sale.updateConcept(saleId, newConcept);
expect(response.concept).toEqual(newConcept);
});
});

View File

@ -25,7 +25,7 @@ module.exports = Self => {
});
Self.updateConcept = async(id, newConcept) => {
let currentLine = await Self.app.models.Sale.findOne({where: {id: id}});
let currentLine = await Self.app.models.Sale.findById(id);
return await currentLine.updateAttributes({concept: newConcept});
};

View File

@ -17,7 +17,7 @@ describe('ticket changeState()', () => {
done();
});
it('should throw an error if the ticket is not editable and the user isnt production', async() => {
it('should throw if the ticket is not editable and the user isnt production', async() => {
let ctx = {req: {accessToken: {userId: 18}}};
let params = {ticketFk: 2, stateFk: 3};

View File

@ -8,11 +8,11 @@ describe('sale transferSales()', () => {
done();
});
it('should throw an error if the ticket is not editable', async() => {
it('should throw an error as the ticket is not editable', async() => {
const ctx = {req: {accessToken: {userId: 101}}};
let error;
const currentTicketId = 10;
const currentTicketId = 1;
const receiverTicketId = undefined;
const sales = [];

View File

@ -13,7 +13,7 @@ describe('ticket updateEditableTicket()', () => {
done();
});
it('should throw an error if the ticket is not editable', async() => {
it('should now throw an error if the ticket is not editable', async() => {
let error;
let ctx = {req: {accessToken: {userId: 9}}};