lion/packages/validate/test-helpers/helper-validators.js
Thijs Louisse 6e81b55e3c feat(validate): new validation api, async validation and more
Co-authored-by: Thomas Allmer <Thomas.Allmer@ing.com>
2019-11-15 16:57:58 +01:00

52 lines
1 KiB
JavaScript

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