Merge pull request '5035-intermittent_backTest2' (!1365) from 5035-intermittent_backTest2 into dev
gitea/salix/pipeline/head There was a failure building this commit Details

Reviewed-on: #1365
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Vicent Llopis 2023-03-06 08:32:14 +00:00
commit 0f021c5183
5 changed files with 4 additions and 5 deletions

View File

@ -44,7 +44,7 @@ module.exports = Self => {
try {
const invoiceOut = await Self.findById(id, null, myOptions);
const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions);
console.log(invoiceOut, !hasInvoicing);
if (invoiceOut.hasPdf && !hasInvoicing)
throw new UserError(`You don't have enough privileges`);

View File

@ -47,6 +47,7 @@ module.exports = Self => {
ids = ids.split(',');
for (let id of ids) {
console.log(zipConfig, totalSize, zipConfig ? zipConfig.maxSize : null);
if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large');
const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions);
const fileName = extractFileName(invoiceOutPdf[2]);

View File

@ -11,7 +11,6 @@ describe('InvoiceOut createPdf()', () => {
const ctx = {req: activeCtx};
it('should create a new PDF file and set true the hasPdf property', async() => {
pending('https://redmine.verdnatura.es/issues/5035');
const invoiceId = 1;
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx

View File

@ -30,8 +30,6 @@ describe('InvoiceOut downloadZip()', () => {
});
it('should return an error if the size of the files is too large', async() => {
pending('https://redmine.verdnatura.es/issues/5035');
const tx = await models.InvoiceOut.beginTransaction({});
let error;

View File

@ -65,8 +65,9 @@ describe('InvoiceOut filter()', () => {
await invoiceOut.updateAttribute('hasPdf', true, options);
const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options);
console.log(result);
expect(result.length).toBeGreaterThanOrEqual(1);
expect(result.length).toEqual(1);
await tx.rollback();
} catch (e) {