TF-2517 Fix rename/create a folder with special characters do not show error message

This commit is contained in:
dab246
2024-08-05 12:40:26 +07:00
committed by Dat H. Pham
parent 8d8d23529b
commit f77d62831c
7 changed files with 64 additions and 10 deletions
@@ -0,0 +1,39 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:tmail_ui_user/features/mailbox_creator/domain/extensions/mailbox_name_special_character_validator_extension.dart';
void main() {
group('isValid::test', () {
test('should return true for a valid string', () {
expect('hello'.isValid, isTrue);
});
test('should return false for a string starting with #', () {
expect('#hello'.isValid, isFalse);
});
test('should return false for a string containing %', () {
expect('hello%world'.isValid, isFalse);
});
test('should return false for a string containing *', () {
expect('hello*world'.isValid, isFalse);
});
test('should return false for a string containing \\n', () {
expect('hello\nworld'.isValid, isFalse);
});
test('should return false for a string containing \\r', () {
expect('hello\rworld'.isValid, isFalse);
});
test('should return true for an empty string', () {
expect(''.isValid, isTrue);
});
test('should return true for a string with no forbidden characters and not starting with #', () {
expect('validString123'.isValid, isTrue);
});
});
}