Skip to content

Commit

Permalink
feat: ensure EmailValidation returns InvalidFieldError with email mes…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
vitorverasm committed Jan 30, 2021
1 parent c4cebea commit e79d725
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/validation/validators/email-validation/email-validation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {InvalidFieldError} from '@/validation/errors';
import {FieldValidation} from '@/validation/protocols';

export class EmailValidation implements FieldValidation {
constructor(readonly field: string) {}
validate(value: string): Error {
console.log(value);
return new InvalidFieldError('email');
}
}
1 change: 1 addition & 0 deletions src/validation/validators/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './email-validation/email-validation';
export * from './required-field/required-field-validation';

0 comments on commit e79d725

Please sign in to comment.