ref #5914 fixed back test

This commit is contained in:
Jorge Penadés 2023-09-25 14:01:40 +02:00
parent 98ee9bbaf3
commit 64eb216367
1 changed files with 18 additions and 9 deletions

View File

@ -3,17 +3,18 @@ const models = require('vn-loopback/server/server').models;
describe('InvoiceOut tranferInvoice()', () => {
const userId = 5;
const ctx = {req: {accessToken: userId}};
ctx.args = {
id: '1',
ref: 'T1111111',
newClientFk: 1,
cplusRectificationId: 1,
cplusInvoiceType477Id: 1,
invoiceCorrectionTypeId: 1
};
it('should return the id of the created issued invoice', async() => {
const tx = await models.InvoiceOut.beginTransaction({});
const options = {transaction: tx};
const args = {
id: '1',
ref: 'T1111111',
newClientFk: 1,
cplusRectificationId: 1,
cplusInvoiceType477Id: 1,
invoiceCorrectionTypeId: 1
};
ctx.args = args;
try {
const result = await models.InvoiceOut.transferInvoice(
ctx,
@ -30,8 +31,16 @@ describe('InvoiceOut tranferInvoice()', () => {
it('should throw an UserError when it is the same client', async() => {
const tx = await models.InvoiceOut.beginTransaction({});
const options = {transaction: tx};
const args = {
id: '1',
ref: 'T1111111',
newClientFk: 1101,
cplusRectificationId: 1,
cplusInvoiceType477Id: 1,
invoiceCorrectionTypeId: 1
};
ctx.args = args;
try {
ctx.args.newClientFk = 1101;
await models.InvoiceOut.transferInvoice(
ctx,
options);