fix(clone): invoiceIn clone now adds (2) to the ref
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c7558dfb0b
commit
471da0f4da
|
@ -1,8 +1,7 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
// #3082 clone is broken due to a strange trigger from production
|
describe('InvoiceIn descriptor path', () => {
|
||||||
xdescribe('InvoiceIn descriptor path', () => {
|
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,11 @@ module.exports = Self => {
|
||||||
|
|
||||||
const issued = new Date(sourceInvoiceIn.issued);
|
const issued = new Date(sourceInvoiceIn.issued);
|
||||||
issued.setMonth(issued.getMonth() + 1);
|
issued.setMonth(issued.getMonth() + 1);
|
||||||
|
const clonedRef = sourceInvoiceIn.supplierRef + '(2)';
|
||||||
|
|
||||||
const clone = await models.InvoiceIn.create({
|
const clone = await models.InvoiceIn.create({
|
||||||
serial: sourceInvoiceIn.serial,
|
serial: sourceInvoiceIn.serial,
|
||||||
supplierRef: sourceInvoiceIn.supplierRef,
|
supplierRef: clonedRef,
|
||||||
supplierFk: sourceInvoiceIn.supplierFk,
|
supplierFk: sourceInvoiceIn.supplierFk,
|
||||||
issued: issued,
|
issued: issued,
|
||||||
currencyFk: sourceInvoiceIn.currencyFk,
|
currencyFk: sourceInvoiceIn.currencyFk,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
// #3082 clone is broken due to a strange trigger from production
|
describe('invoiceIn clone()', () => {
|
||||||
xdescribe('invoiceIn clone()', () => {
|
|
||||||
it('should return the cloned invoiceIn and also clone invoiceInDueDays and invoiceInTaxes if there are any referencing the invoiceIn', async() => {
|
it('should return the cloned invoiceIn and also clone invoiceInDueDays and invoiceInTaxes if there are any referencing the invoiceIn', async() => {
|
||||||
const userId = 1;
|
const userId = 1;
|
||||||
const ctx = {
|
const ctx = {
|
||||||
|
@ -18,7 +17,7 @@ xdescribe('invoiceIn clone()', () => {
|
||||||
try {
|
try {
|
||||||
const clone = await models.InvoiceIn.clone(ctx, 1, options);
|
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);
|
const invoiceInTaxes = await models.InvoiceInTax.find({where: {invoiceInFk: clone.id}}, options);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue