lion/packages/validate/test-helpers/ExampleValidators.js
Thomas Allmer 396deb2e3b feat: finalize validation and adopt it everywhere
Co-authored-by: Alex Ghiu <alex.ghiu@ing.com>
Co-authored-by: Gerjan van Geest <Gerjan.van.Geest@ing.com>
Co-authored-by: Thijs Louisse <Thijs.Louisse@ing.com>
Co-authored-by: Joren Broekema <joren.broekema@ing.com>
Co-authored-by: Erik Kroes <erik.kroes@ing.com>
2019-11-18 15:30:08 +01:00

48 lines
857 B
JavaScript

/* eslint-disable max-classes-per-file, class-methods-use-this */
import { Validator } from '../src/Validator.js';
export class AlwaysInvalid extends Validator {
constructor(...args) {
super(...args);
this.name = 'AlwaysInvalid';
}
execute() {
const showMessage = true;
return showMessage;
}
}
export class AlwaysValid extends Validator {
constructor(...args) {
super(...args);
this.name = 'AlwaysValid';
}
execute() {
const showMessage = false;
return showMessage;
}
}
export class AsyncAlwaysValid extends AlwaysValid {
constructor(...args) {
super(...args);
this.async = true;
}
execute() {
return true;
}
}
export class AsyncAlwaysInvalid extends AlwaysValid {
constructor(...args) {
super(...args);
this.async = true;
}
async execute() {
return false;
}
}