Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2322-order_index
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-06-18 11:23:35 +02:00
commit 9af33d1b96
10 changed files with 103 additions and 7 deletions

4
Jenkinsfile vendored
View File

@ -54,6 +54,10 @@ pipeline {
} }
} }
stage('Test') { stage('Test') {
when { not { anyOf {
branch 'test'
branch 'master'
}}}
environment { environment {
NODE_ENV = "" NODE_ENV = ""
} }

View File

@ -4,3 +4,4 @@ apps:
instances: 1 instances: 1
max_restarts: 3 max_restarts: 3
restart_delay: 15000 restart_delay: 15000
node_args: --tls-min-v1.0

View File

@ -54,7 +54,7 @@ module.exports = class Docker {
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
} }
await this.waitForHealthy(); if (runChown) await this.wait();
} catch (err) { } catch (err) {
if (this.isRandom) if (this.isRandom)
await this.rm(); await this.rm();

View File

@ -73,7 +73,7 @@ export function config($translateProvider, $translatePartialLoaderProvider, $htt
return locale; return locale;
if (langOptions.langAliases[locale]) if (langOptions.langAliases[locale])
return langOptions.langAliases[locale]; return langOptions.langAliases[locale];
return fallbackLang; return langOptions.fallbackLang;
}); });
$translatePartialLoaderProvider.addPart(appName); $translatePartialLoaderProvider.addPart(appName);

View File

@ -48,7 +48,7 @@ function backWatch(done) {
// XXX: Workaround to avoid nodemon bug // XXX: Workaround to avoid nodemon bug
// https://github.com/remy/nodemon/issues/1346 // https://github.com/remy/nodemon/issues/1346
let commands = ['node --inspect ./node_modules/gulp/bin/gulp.js']; let commands = ['node --tls-min-v1.0 --inspect ./node_modules/gulp/bin/gulp.js'];
if (!isWindows) commands.unshift('sleep 1'); if (!isWindows) commands.unshift('sleep 1');
nodemon({ nodemon({
@ -136,7 +136,7 @@ function backTest(done) {
const nodemon = require('gulp-nodemon'); const nodemon = require('gulp-nodemon');
nodemon({ nodemon({
exec: ['node ./node_modules/gulp/bin/gulp.js'], exec: ['node --tls-min-v1.0 ./node_modules/gulp/bin/gulp.js'],
args: ['backTestOnce'], args: ['backTestOnce'],
watch: backSources, watch: backSources,
done: done done: done

View File

@ -0,0 +1,27 @@
const app = require('vn-loopback/server/server');
describe('client sendSms()', () => {
let createdLog;
afterAll(async done => {
await app.models.ClientLog.destroyById(createdLog.id);
done();
});
it('should send a message and log it', async() => {
let ctx = {req: {accessToken: {userId: 9}}};
let id = 101;
let destination = 222222222;
let message = 'this is the message created in a test';
let sms = await app.models.Client.sendSms(ctx, id, destination, message);
logId = sms.logId;
createdLog = await app.models.ClientLog.findById(logId);
let json = JSON.parse(JSON.stringify(createdLog.newInstance));
expect(json.message).toEqual(message);
});
});

View File

@ -0,0 +1,37 @@
const app = require('vn-loopback/server/server');
const soap = require('soap');
describe('sms send()', () => {
it('should return the expected message and status code', async() => {
const code = 200;
const smsConfig = await app.models.SmsConfig.findOne();
const soapClient = await soap.createClientAsync(smsConfig.uri);
spyOn(soap, 'createClientAsync').and.returnValue(soapClient);
spyOn(soapClient, 'sendSMSAsync').and.returnValue([{
result: {
$value:
`<xtratelecom-sms-response>
<sms>
<codigo>
${code}
</codigo>
<descripcion>
Envio en procesamiento
</descripcion>
<messageId>
1
</messageId>
</sms>
<procesoId>
444328681
</procesoId>
</xtratelecom-sms-response>`
}
}]);
let ctx = {req: {accessToken: {userId: 1}}};
let result = await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
expect(result.statusCode).toEqual(200);
expect(result.status).toContain('Fake response');
});
});

View File

@ -0,0 +1,27 @@
const app = require('vn-loopback/server/server');
describe('ticket sendSms()', () => {
let logId;
afterAll(async done => {
await app.models.TicketLog.destroyById(logId);
done();
});
it('should send a message and log it', async() => {
let ctx = {req: {accessToken: {userId: 9}}};
let id = 11;
let destination = 222222222;
let message = 'this is the message created in a test';
let sms = await app.models.Ticket.sendSms(ctx, id, destination, message);
logId = sms.logId;
let createdLog = await app.models.TicketLog.findById(logId);
let json = JSON.parse(JSON.stringify(createdLog.newInstance));
expect(json.message).toEqual(message);
});
});

View File

@ -99,8 +99,8 @@
</vn-td> </vn-td>
<vn-td shrink> <vn-td shrink>
<img <img
ng-src="{{::$root.imagePath}}/50x50/{{sale.image}}" ng-src="{{::$root.imagePath}}/catalog/50x50/{{sale.image}}"
zoom-image="{{::$root.imagePath}}/1600x900/{{sale.image}}" zoom-image="{{::$root.imagePath}}/catalog/1600x900/{{sale.image}}"
on-error-src/> on-error-src/>
</vn-td> </vn-td>
<vn-td vn-focus number> <vn-td vn-focus number>