From 866432a3dbe07f4510fc9e7ce1dc32d68b5a4d99 Mon Sep 17 00:00:00 2001 From: pdenert Date: Tue, 5 Nov 2024 10:09:02 +0100 Subject: [PATCH] Keep emojis in single class --- packages/patrol_log/lib/src/emojis.dart | 11 +++++++++++ packages/patrol_log/lib/src/log_entry.dart | 3 ++- packages/patrol_log/lib/src/patrol_log_reader.dart | 13 +++++++------ packages/patrol_log/lib/src/test_entry.dart | 9 +++++---- 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 packages/patrol_log/lib/src/emojis.dart diff --git a/packages/patrol_log/lib/src/emojis.dart b/packages/patrol_log/lib/src/emojis.dart new file mode 100644 index 000000000..95d9d5322 --- /dev/null +++ b/packages/patrol_log/lib/src/emojis.dart @@ -0,0 +1,11 @@ +class Emojis { + static const String waiting = '⏳'; + static const String testStart = 'πŸ§ͺ'; + static const String success = 'βœ…'; + static const String failure = '❌'; + static const String skip = '⏩'; + static const String log = 'πŸ“'; + static const String report = 'πŸ“Š'; + static const String duration = '⏱️ '; + static const String total = 'πŸ“'; +} diff --git a/packages/patrol_log/lib/src/log_entry.dart b/packages/patrol_log/lib/src/log_entry.dart index de0ca58ac..4975263c4 100644 --- a/packages/patrol_log/lib/src/log_entry.dart +++ b/packages/patrol_log/lib/src/log_entry.dart @@ -1,3 +1,4 @@ +import 'package:patrol_log/src/emojis.dart'; import 'package:patrol_log/src/entry.dart'; class LogEntry extends Entry { @@ -26,7 +27,7 @@ class LogEntry extends Entry { @override String pretty() { - return '$indentationπŸ“ $message'; + return '$indentation${Emojis.log} $message'; } @override diff --git a/packages/patrol_log/lib/src/patrol_log_reader.dart b/packages/patrol_log/lib/src/patrol_log_reader.dart index 643c9cdaa..18f9bf4d7 100644 --- a/packages/patrol_log/lib/src/patrol_log_reader.dart +++ b/packages/patrol_log/lib/src/patrol_log_reader.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:dispose_scope/dispose_scope.dart'; import 'package:patrol_log/patrol_log.dart'; +import 'package:patrol_log/src/emojis.dart'; class PatrolLogReader { PatrolLogReader({ @@ -175,13 +176,13 @@ class PatrolLogReader { /// - Path to the report file /// - Duration of the tests String get summary => 'Test summary:\n' - 'πŸ“ Total: $totalTests\n' - 'βœ… Successful: $successfulTests\n' - '❌ Failed: $failedTestsCount\n' + '${Emojis.total} Total: $totalTests\n' + '${Emojis.success} Successful: $successfulTests\n' + '${Emojis.failure} Failed: $failedTestsCount\n' '${failedTestsCount > 0 ? '$failedTestsList\n' : ''}' - '⏩ Skipped: $skippedTests\n' - 'πŸ“Š Report: $reportPath\n' - '⏱️ Duration: ${_stopwatch.elapsed.inSeconds}s\n'; + '${Emojis.skip} Skipped: $skippedTests\n' + '${Emojis.report} Report: $reportPath\n' + '${Emojis.duration} Duration: ${_stopwatch.elapsed.inSeconds}s\n'; /// Closes the stream subscription and the stream controller. void close() { diff --git a/packages/patrol_log/lib/src/test_entry.dart b/packages/patrol_log/lib/src/test_entry.dart index c551ae6f0..923f749f6 100644 --- a/packages/patrol_log/lib/src/test_entry.dart +++ b/packages/patrol_log/lib/src/test_entry.dart @@ -1,3 +1,4 @@ +import 'package:patrol_log/src/emojis.dart'; import 'package:patrol_log/src/entry.dart'; class TestEntry extends Entry { @@ -63,9 +64,9 @@ enum TestEntryStatus { skip; String get name => switch (this) { - TestEntryStatus.start => 'πŸ§ͺ', - TestEntryStatus.success => 'βœ…', - TestEntryStatus.failure => '❌', - TestEntryStatus.skip => '⏩', + TestEntryStatus.start => Emojis.testStart, + TestEntryStatus.success => Emojis.success, + TestEntryStatus.failure => Emojis.failure, + TestEntryStatus.skip => Emojis.skip, }; }