diff --git a/core/test/linkify_html_test.dart b/core/test/linkify_html_test.dart new file mode 100644 index 000000000..629f00ee0 --- /dev/null +++ b/core/test/linkify_html_test.dart @@ -0,0 +1,46 @@ + +import 'package:core/utils/linkify_html.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group('linkify_html test', () { + + final linkifyHtml = LinkifyHtml(); + + test( + 'generateLinkify should return url when input text contain http/https/ftp', + () async { + final htmlValidate = linkifyHtml.generateLinkify( + 'See at Hanoi' + ); + expect( + htmlValidate, + equals('See <https://linagora.com> at Hanoi')); + } + ); + + test( + 'generateLinkify should return www when input text contain www', + () async { + final htmlValidate = linkifyHtml.generateLinkify( + 'See www.google.com at Hanoi' + ); + expect( + htmlValidate, + equals('See www.google.com at Hanoi')); + } + ); + + test( + 'generateLinkify should return url when input text contain email address', + () async { + final htmlValidate = linkifyHtml.generateLinkify( + 'See tdvu@linagora.com at Hanoi' + ); + expect( + htmlValidate, + equals('See tdvu@linagora.com at Hanoi')); + } + ); + }); +} \ No newline at end of file