Show cached schedule coverage status in admin
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jamshalat_masjid_screen/core/enums.dart';
|
||||
import 'package:jamshalat_masjid_screen/data/local/models.dart';
|
||||
import 'package:jamshalat_masjid_screen/data/services/hijri_service.dart';
|
||||
import 'package:jamshalat_masjid_screen/data/services/sync_service.dart';
|
||||
|
||||
void main() {
|
||||
group('PrayerName display labels', () {
|
||||
@@ -56,4 +57,42 @@ void main() {
|
||||
expect(label, '11 Syawal 1447 H');
|
||||
});
|
||||
});
|
||||
|
||||
group('ScheduleCacheStatus', () {
|
||||
test('derives cached date range and days left from stored schedules', () {
|
||||
final status = ScheduleCacheStatus.fromSchedules(
|
||||
[
|
||||
DailyPrayerSchedule(
|
||||
date: '2026-03-01',
|
||||
imsak: '04:20',
|
||||
subuh: '04:30',
|
||||
terbit: '05:45',
|
||||
dhuha: '06:10',
|
||||
dzuhur: '11:55',
|
||||
ashar: '15:10',
|
||||
maghrib: '17:58',
|
||||
isya: '19:05',
|
||||
),
|
||||
DailyPrayerSchedule(
|
||||
date: '2026-04-30',
|
||||
imsak: '04:19',
|
||||
subuh: '04:29',
|
||||
terbit: '05:44',
|
||||
dhuha: '06:09',
|
||||
dzuhur: '11:54',
|
||||
ashar: '15:09',
|
||||
maghrib: '17:57',
|
||||
isya: '19:04',
|
||||
),
|
||||
],
|
||||
DateTime(2026, 3, 30),
|
||||
);
|
||||
|
||||
expect(status.hasData, isTrue);
|
||||
expect(status.startDate, DateTime(2026, 3, 1));
|
||||
expect(status.endDate, DateTime(2026, 4, 30));
|
||||
expect(status.cachedDays, 2);
|
||||
expect(status.daysUntilRefresh, 31);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user