diff --git a/Jenkinsfile b/Jenkinsfile index 9af09b306..2848ea59b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,6 +54,10 @@ pipeline { } } stage('Test') { + when { not { anyOf { + branch 'test' + branch 'master' + }}} environment { NODE_ENV = "" } diff --git a/back/process.yml b/back/process.yml index 41a2fafff..38d2b9eaf 100644 --- a/back/process.yml +++ b/back/process.yml @@ -4,3 +4,4 @@ apps: instances: 1 max_restarts: 3 restart_delay: 15000 + node_args: --tls-min-v1.0 diff --git a/db/docker.js b/db/docker.js index e3f105971..0a221a0be 100644 --- a/db/docker.js +++ b/db/docker.js @@ -54,7 +54,7 @@ module.exports = class Docker { this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; } - await this.waitForHealthy(); + if (runChown) await this.wait(); } catch (err) { if (this.isRandom) await this.rm(); diff --git a/front/salix/module.js b/front/salix/module.js index c3e8dcb8a..2c61af4d1 100644 --- a/front/salix/module.js +++ b/front/salix/module.js @@ -73,7 +73,7 @@ export function config($translateProvider, $translatePartialLoaderProvider, $htt return locale; if (langOptions.langAliases[locale]) return langOptions.langAliases[locale]; - return fallbackLang; + return langOptions.fallbackLang; }); $translatePartialLoaderProvider.addPart(appName); diff --git a/gulpfile.js b/gulpfile.js index 6cf75e3fc..b946b48de 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -48,7 +48,7 @@ function backWatch(done) { // XXX: Workaround to avoid nodemon bug // 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'); nodemon({ @@ -136,7 +136,7 @@ function backTest(done) { const nodemon = require('gulp-nodemon'); nodemon({ - exec: ['node ./node_modules/gulp/bin/gulp.js'], + exec: ['node --tls-min-v1.0 ./node_modules/gulp/bin/gulp.js'], args: ['backTestOnce'], watch: backSources, done: done diff --git a/modules/claim/front/locale/es.yml b/modules/claim/front/locale/es.yml index 8dae33272..5570896c1 100644 --- a/modules/claim/front/locale/es.yml +++ b/modules/claim/front/locale/es.yml @@ -15,4 +15,4 @@ Show Pickup order: Ver orden de recogida Search claim by id or client name: Buscar reclamaciones por identificador o nombre de cliente Claim deleted!: ReclamaciĆ³n eliminada! claim: reclamaciĆ³n -Photos: Fotos \ No newline at end of file +Photos: Fotos diff --git a/modules/client/back/methods/client/specs/sendSms.spec.js b/modules/client/back/methods/client/specs/sendSms.spec.js new file mode 100644 index 000000000..b299ac3c1 --- /dev/null +++ b/modules/client/back/methods/client/specs/sendSms.spec.js @@ -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); + }); +}); diff --git a/modules/client/back/methods/sms/send.spec.js b/modules/client/back/methods/sms/send.spec.js new file mode 100644 index 000000000..612a16cf1 --- /dev/null +++ b/modules/client/back/methods/sms/send.spec.js @@ -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: + ` + + + ${code} + + + Envio en procesamiento + + + 1 + + + + 444328681 + + ` + } + }]); + 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'); + }); +}); diff --git a/modules/ticket/back/methods/ticket/specs/sendSms.spec.js b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js new file mode 100644 index 000000000..20066a5ba --- /dev/null +++ b/modules/ticket/back/methods/ticket/specs/sendSms.spec.js @@ -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); + }); +}); diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index fa569161e..f5ec9cf0b 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -99,8 +99,8 @@