minor fixes
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
f7fa363fa5
commit
cd4f93f326
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue