fix(player): 评论总数含回复并改用相对时间

This commit is contained in:
Zhou Weidong committed 2026-10-21 12:00:27 +08:00
1 parent 22cb74ded4
commit 2659c29501
14 files changed
+212 -9

No files matched your search

@@ -0,0 +1,57 @@
// Author: fruit.com.cn
import 'package:flutter_test/flutter_test.dart';
import 'package:fruitshorts/core/formatting/relative_date_time.dart';
import 'package:fruitshorts/l10n/app_localizations_en.dart';
void main() {
final l10n = AppLocalizationsEn();
final now = DateTime(2026, 10, 21, 12);
test('should_show_just_now_under_one_minute', () {
expect(
formatRelativeDateTime(
now.subtract(const Duration(seconds: 59)),
l10n,
now: now,
),
'Just now',
);
});
test('should_use_minutes_below_sixty_minutes', () {
expect(
formatRelativeDateTime(
now.subtract(const Duration(minutes: 59)),
l10n,
now: now,
),
'59 min ago',
);
});
test('should_use_hours_below_twenty_four_hours', () {
expect(
formatRelativeDateTime(
now.subtract(const Duration(hours: 23)),
l10n,
now: now,
),
'23 hours ago',
);
});
test('should_use_month_and_day_for_same_year', () {
expect(
formatRelativeDateTime(DateTime(2026, 9, 3), l10n, now: now),
'09-03',
);
});
test('should_use_full_date_for_previous_year', () {
expect(
formatRelativeDateTime(DateTime(2025, 12, 31), l10n, now: now),
'2025-12-31',
);
});
}