Skip to content

Commit

Permalink
fix message error in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wellgenio committed Aug 24, 2024
1 parent df75687 commit cdd11e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/src/lucid_validation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class _PropSelector<E, TProp> {
///
/// [E] represents the type of the entity being validated.
abstract class LucidValidation<E> {
final List<_PropSelector> _propSelectors = [];
final List<_PropSelector<E, dynamic>> _propSelectors = [];

/// Registers a validation rule for a specific property of the entity.
///
Expand Down
14 changes: 7 additions & 7 deletions test/lucid_validation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ void main() {

expect(errors.length, 2);
expect(errors.first.key, 'email');
expect(errors.first.message, 'This field cannot be empty');
expect(errors[1].message, 'E-mail in invalid format');
expect(errors.first.message, 'Cannot be empty');
expect(errors[1].message, 'Invalid email address');
});

test('when validating [UserModel] should return a list of error messages for the password field', () {
Expand All @@ -33,12 +33,12 @@ void main() {

expect(errors.length, 6);
expect(errors.first.key, 'password');
expect(errors.first.message, 'This field cannot be empty');
expect(errors.first.message, 'Cannot be empty');
expect(errors[1].message, 'Must be at least 8 characters long');
expect(errors[2].message, 'Must contain lowercase');
expect(errors[3].message, 'Must contain uppercase');
expect(errors[4].message, 'Must contain number');
expect(errors[5].message, 'Must contain special character');
expect(errors[2].message, 'Must contain at least one lowercase letter');
expect(errors[3].message, 'Must contain at least one uppercase letter');
expect(errors[4].message, 'Must contain at least one numeric digit');
expect(errors[5].message, 'Must contain at least one special character');
});

test('when validating [UserModel] should return a list of error messages for the age field', () {
Expand Down

0 comments on commit cdd11e5

Please sign in to comment.