yumi-flutter/test/sc_conversation_time_formatter_test.dart

39 lines
920 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:yumi/shared/tools/sc_conversation_time_formatter.dart';
void main() {
group('SCConversationTimeFormatter.format', () {
final now = DateTime(2026, 7, 14, 16, 30);
test('shows the full date for a different year', () {
expect(
SCConversationTimeFormatter.format(
DateTime(2025, 12, 31, 23, 59),
now: now,
),
'2025-12-31',
);
});
test('shows month, day, and time for another day this year', () {
expect(
SCConversationTimeFormatter.format(
DateTime(2026, 7, 13, 8, 5),
now: now,
),
'07-13 08.05',
);
});
test('shows only the time for today', () {
expect(
SCConversationTimeFormatter.format(
DateTime(2026, 7, 14, 8, 5),
now: now,
),
'08.05',
);
});
});
}