Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3095-item.shelving
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
434db10ac9
|
@ -41,11 +41,14 @@ async function test() {
|
|||
}
|
||||
}));
|
||||
|
||||
jasmine.exitOnCompletion = false;
|
||||
|
||||
if (isCI) {
|
||||
const JunitReporter = require('jasmine-reporters');
|
||||
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||
|
||||
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
|
||||
jasmine.exitOnCompletion = true;
|
||||
}
|
||||
|
||||
const backSpecs = [
|
||||
|
@ -60,11 +63,10 @@ async function test() {
|
|||
helpers: [],
|
||||
});
|
||||
|
||||
jasmine.exitOnCompletion = false;
|
||||
await jasmine.execute();
|
||||
if (app) await app.disconnect();
|
||||
if (container) await container.rm();
|
||||
console.log('app disconnected & container removed');
|
||||
console.log('App disconnected & container removed');
|
||||
}
|
||||
|
||||
test();
|
||||
|
|
19
db/docker.js
19
db/docker.js
|
@ -42,8 +42,16 @@ module.exports = class Docker {
|
|||
|
||||
let runChown = process.platform != 'linux';
|
||||
|
||||
let network = '';
|
||||
if (ci) network = '--network="jenkins"';
|
||||
|
||||
log('Starting container...');
|
||||
const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||
const container = await this.execP(`
|
||||
docker run \
|
||||
${network} \
|
||||
--env RUN_CHOWN=${runChown} \
|
||||
-d ${dockerArgs} salix-db
|
||||
`);
|
||||
this.id = container.stdout.trim();
|
||||
|
||||
try {
|
||||
|
@ -51,10 +59,11 @@ module.exports = class Docker {
|
|||
let inspect = await this.execP(`docker inspect -f "{{json .NetworkSettings}}" ${this.id}`);
|
||||
let netSettings = JSON.parse(inspect.stdout);
|
||||
|
||||
if (ci)
|
||||
this.dbConf.host = netSettings.Gateway;
|
||||
|
||||
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||
if (ci) {
|
||||
this.dbConf.host = netSettings.Networks.jenkins.IPAddress;
|
||||
this.dbConf.port = 3306;
|
||||
} else
|
||||
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||
}
|
||||
|
||||
await this.wait();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const {Report, storage} = require('vn-print');
|
||||
const print = require('vn-print');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('createPdf', {
|
||||
|
@ -52,7 +52,7 @@ module.exports = Self => {
|
|||
hasPdf: true
|
||||
}, myOptions);
|
||||
|
||||
const invoiceReport = new Report('invoice', {
|
||||
const invoiceReport = new print.Report('invoice', {
|
||||
reference: invoiceOut.ref,
|
||||
recipientId: invoiceOut.clientFk
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ module.exports = Self => {
|
|||
const fileName = `${year}${invoiceOut.ref}.pdf`;
|
||||
|
||||
// Store invoice
|
||||
storage.write(stream, {
|
||||
print.storage.write(stream, {
|
||||
type: 'invoice',
|
||||
path: `${year}/${month}/${day}`,
|
||||
fileName: fileName
|
||||
|
|
|
@ -62,8 +62,14 @@ module.exports = Self => {
|
|||
name: fileName
|
||||
};
|
||||
|
||||
await fs.access(file.path);
|
||||
let stream = fs.createReadStream(file.path);
|
||||
try {
|
||||
await fs.access(file.path);
|
||||
} catch (error) {
|
||||
await Self.createPdf(ctx, id);
|
||||
}
|
||||
|
||||
const stream = fs.createReadStream(file.path);
|
||||
|
||||
return [stream, file.contentType, `filename="${file.name}"`];
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT')
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const fs = require('fs-extra');
|
||||
const axios = require('axios');
|
||||
const print = require('vn-print');
|
||||
|
||||
describe('InvoiceOut createPdf()', () => {
|
||||
const userId = 1;
|
||||
|
@ -16,22 +15,15 @@ describe('InvoiceOut createPdf()', () => {
|
|||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
const response = {
|
||||
data: {
|
||||
pipe: () => {},
|
||||
on: () => {},
|
||||
|
||||
spyOn(print, 'Report').and.returnValue({
|
||||
toPdfStream: () => {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(response)));
|
||||
spyOn(models.InvoiceContainer, 'container').and.returnValue({
|
||||
client: {root: '/path'}
|
||||
});
|
||||
spyOn(fs, 'mkdir').and.returnValue(true);
|
||||
spyOn(fs, 'createWriteStream').and.returnValue({
|
||||
on: (event, cb) => cb(),
|
||||
end: () => {}
|
||||
});
|
||||
|
||||
spyOn(print.storage, 'write').and.returnValue(true);
|
||||
|
||||
const tx = await models.InvoiceOut.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@
|
|||
"juice": "^5.2.0",
|
||||
"mysql2": "^1.7.0",
|
||||
"nodemailer": "^4.7.0",
|
||||
"puppeteer": "^2.0.0",
|
||||
"puppeteer": "^18.0.5",
|
||||
"qrcode": "^1.4.2",
|
||||
"strftime": "^0.10.0",
|
||||
"vue": "^2.6.10",
|
||||
|
|
Loading…
Reference in New Issue