diff --git a/README.md b/README.md index da51fe093..32377c115 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ Salix is also the scientific name of a beautifull tree! :) Required applications. -* Node.js = 14.15.1 LTS +* Node.js = 14.x LTS +* Docker +* Git * Docker You will need to install globally the following items. diff --git a/modules/supplier/back/models/specs/supplier-account.spec.js b/modules/supplier/back/models/specs/supplier-account.spec.js index 438b87f8c..f56e70a89 100644 --- a/modules/supplier/back/models/specs/supplier-account.spec.js +++ b/modules/supplier/back/models/specs/supplier-account.spec.js @@ -9,19 +9,18 @@ describe('loopback model Supplier-account', () => { let error; const expectedError = 'The IBAN does not have the correct format'; const iban = 'incorrect format'; - // si falla el error es extraño preguntar a carlos - - await app.models.SupplierAccount.create( - { - supplierFk: supplierId, - bankEntityFk: bankEntityId, - iban: iban - } - ).catch(e => { + try { + await app.models.SupplierAccount.create( + { + supplierFk: supplierId, + bankEntityFk: bankEntityId, + iban: iban + }); + } catch (e) { error = e; expect(error.message).toContain(expectedError); - }); + } expect(error).toBeDefined(); }); @@ -47,13 +46,12 @@ describe('loopback model Supplier-account', () => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - const createdSupplierAccount = await app.models.SupplierAccount.create( - { - supplierFk: supplierId, - bankEntityFk: bankEntityId, - iban: iban - } - , options); + const createdSupplierAccount = await app.models.SupplierAccount.create({ + supplierFk: supplierId, + bankEntityFk: bankEntityId, + iban: iban + }, + options); expect(createdSupplierAccount.iban).toBe(iban); await tx.rollback(); diff --git a/modules/supplier/back/models/supplier-account.js b/modules/supplier/back/models/supplier-account.js index 9d6f10e3c..85bf37510 100644 --- a/modules/supplier/back/models/supplier-account.js +++ b/modules/supplier/back/models/supplier-account.js @@ -1,11 +1,11 @@ const validateIban = require('vn-loopback/util/validateIban'); module.exports = Self => { - Self.validateAsync('iban', ibanNeedsValidation, { + Self.validateAsync('iban', ibanValidation, { message: 'The IBAN does not have the correct format' }); - async function ibanNeedsValidation(err, done) { + async function ibanValidation(err, done) { let filter = { fields: ['code'], where: {id: this.countryFk}