feat(tests): test coverage is 70.5

This commit is contained in:
misha
2026-01-26 16:38:15 +03:00
parent 92205c09d6
commit 29589ef6fd
49 changed files with 2690 additions and 18 deletions

View File

@@ -125,6 +125,34 @@ void main() {
expect(AppConstants.commentsEndpoint, '/comments');
});
});
group('Regex validation', () {
test('email regex validates correct emails', () {
final regex = RegExp(AppConstants.emailRegex);
expect(regex.hasMatch('test@example.com'), isTrue);
expect(regex.hasMatch('user.name@domain.co.uk'), isTrue);
expect(regex.hasMatch('invalid-email'), isFalse);
expect(regex.hasMatch('@example.com'), isFalse);
});
test('phone regex validates correct phones', () {
final regex = RegExp(AppConstants.phoneRegex);
expect(regex.hasMatch('+1234567890'), isTrue);
expect(regex.hasMatch('1234567890'), isTrue);
expect(regex.hasMatch('+123'), isTrue);
expect(regex.hasMatch('invalid'), isFalse);
expect(regex.hasMatch('+0123456789'), isFalse);
});
test('url regex validates correct URLs', () {
final regex = RegExp(AppConstants.urlRegex);
expect(regex.hasMatch('https://example.com'), isTrue);
expect(regex.hasMatch('http://www.example.com'), isTrue);
expect(regex.hasMatch('https://example.com/path?query=value'), isTrue);
expect(regex.hasMatch('invalid-url'), isFalse);
expect(regex.hasMatch('ftp://example.com'), isFalse);
});
});
});
}