refs #6176 book entry deleted
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Andrés 2023-09-07 13:21:03 +02:00
parent ea771cb910
commit 4784e71350
3 changed files with 13 additions and 19 deletions

View File

@ -2,18 +2,24 @@ const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('invoiceOut delete()', () => {
const invoiceId = 2;
const invoiceOutId = 2;
const userId = 106;
const activeCtx = {
accessToken: {userId: userId},
};
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
});
it('should check that there is one ticket in the target invoiceOut', async() => {
const tx = await models.InvoiceOut.beginTransaction({});
const options = {transaction: tx};
try {
const invoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options);
const invoiceOut = await models.InvoiceOut.findById(invoiceOutId , {}, options);
const tickets = await models.Ticket.find({where: {refFk: invoiceOut.ref}}, options);
expect(tickets.length).toEqual(1);
@ -31,14 +37,10 @@ describe('invoiceOut delete()', () => {
const options = {transaction: tx};
try {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
await models.InvoiceOut.delete(invoiceId, options);
await models.InvoiceOut.delete(invoiceOutId, options);
const originalTicket = await models.Ticket.findById(3, {}, options);
const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceId, {}, options);
const deletedInvoiceOut = await models.InvoiceOut.findById(invoiceOutId, {}, options);
expect(deletedInvoiceOut).toBeNull();
expect(originalTicket.refFk).toBeNull();
@ -54,11 +56,7 @@ describe('invoiceOut delete()', () => {
const tx = await models.InvoiceOut.beginTransaction({});
const options = {transaction: tx};
try {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
try {
const filter = {
where: {
ASIEN: 2
@ -110,10 +108,6 @@ describe('invoiceOut delete()', () => {
const options = {transaction: tx};
try {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
const filter = {
where: {
ASIEN: 1

View File

@ -2,4 +2,4 @@ Subject: Linked Accounting Entry Deleted
Title: Linked Accounting Entry Deleted
Description: The linked accounting entry that was associated with SAGE has been deleted. <br/><br/>
Entry No. {0} <br/><br/>
This entry has been deleted because the associated invoice {0} has been removed.
This entry has been deleted because the associated invoice {1} has been removed.

View File

@ -2,4 +2,4 @@ subject: Asiento contable enlazado eliminado
title: Asiento contable enlazado eliminado
description: Se ha borrado el asiento contable que se encuentraba enlazado a SAGE <br/><br/>
Asientos nº {0} <br/><br/>
Este asiento se ha borrado porque se ha eliminado la factura asociada {0}
Este asiento se ha borrado porque se ha eliminado la factura asociada {1}