fix(clone): invoiceIn clone now adds (2) to the ref
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-09-07 11:55:26 +02:00
parent c7558dfb0b
commit 471da0f4da
3 changed files with 5 additions and 6 deletions

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
// #3082 clone is broken due to a strange trigger from production
xdescribe('InvoiceIn descriptor path', () => {
describe('InvoiceIn descriptor path', () => {
let browser;
let page;

View File

@ -52,10 +52,11 @@ module.exports = Self => {
const issued = new Date(sourceInvoiceIn.issued);
issued.setMonth(issued.getMonth() + 1);
const clonedRef = sourceInvoiceIn.supplierRef + '(2)';
const clone = await models.InvoiceIn.create({
serial: sourceInvoiceIn.serial,
supplierRef: sourceInvoiceIn.supplierRef,
supplierRef: clonedRef,
supplierFk: sourceInvoiceIn.supplierFk,
issued: issued,
currencyFk: sourceInvoiceIn.currencyFk,

View File

@ -1,7 +1,6 @@
const models = require('vn-loopback/server/server').models;
// #3082 clone is broken due to a strange trigger from production
xdescribe('invoiceIn clone()', () => {
describe('invoiceIn clone()', () => {
it('should return the cloned invoiceIn and also clone invoiceInDueDays and invoiceInTaxes if there are any referencing the invoiceIn', async() => {
const userId = 1;
const ctx = {
@ -18,7 +17,7 @@ xdescribe('invoiceIn clone()', () => {
try {
const clone = await models.InvoiceIn.clone(ctx, 1, options);
expect(clone.supplierRef).toEqual('1234');
expect(clone.supplierRef).toEqual('1234(2)');
const invoiceInTaxes = await models.InvoiceInTax.find({where: {invoiceInFk: clone.id}}, options);