From 86630be3989439dd4da305030264fec481559837 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Tue, 2 Jan 2018 08:26:46 +0100 Subject: [PATCH] validation unit tests for validation > validator presence plus small refactor on validator --- client/core/src/directives/specs/validation.spec.js | 1 - client/core/src/lib/validator.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/client/core/src/directives/specs/validation.spec.js b/client/core/src/directives/specs/validation.spec.js index 33fdbc6fd..1b39a862c 100644 --- a/client/core/src/directives/specs/validation.spec.js +++ b/client/core/src/directives/specs/validation.spec.js @@ -34,7 +34,6 @@ describe('Directive validation', () => { }).toThrow(new Error(`vnValidation: Entity 'User' doesn't exist`)); }); - // should adapt the test to whathver needs to test the user name instead of mail validation as it should be in mail-validation.js describe('Validator Presence()', () => { it('should not validate the user name as it is an empty string', () => { let html = `
`; diff --git a/client/core/src/lib/validator.js b/client/core/src/lib/validator.js index ce6dc989b..d25776ab3 100644 --- a/client/core/src/lib/validator.js +++ b/client/core/src/lib/validator.js @@ -5,7 +5,7 @@ export const validators = { if (validator.isEmpty(value)) throw new Error(`Value can't be empty`); }, - absence: function(value, conf) { + absence: value => { if (!validator.isEmpty(value)) throw new Error(`Value should be empty`); },