#1719 claim.detail cambiar descuento falla
This commit is contained in:
parent
1841e4edb0
commit
65981099b6
|
@ -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',
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
|
@ -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});
|
||||
};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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 = [];
|
||||
|
||||
|
|
|
@ -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}}};
|
||||
|
||||
|
|
Loading…
Reference in New Issue