Harden app for 24-7 offline-first operation
This commit is contained in:
@@ -30,11 +30,13 @@ void main() {
|
||||
masjidName: 'Masjid Raya',
|
||||
cityIdApi: '1301',
|
||||
iqomahDzuhur: 12,
|
||||
lastAutoSyncAttemptDate: '2026-03-31T09:00:00.000',
|
||||
);
|
||||
|
||||
expect(updated.masjidName, 'Masjid Raya');
|
||||
expect(updated.cityIdApi, '1301');
|
||||
expect(updated.iqomahDzuhur, 12);
|
||||
expect(updated.lastAutoSyncAttemptDate, '2026-03-31T09:00:00.000');
|
||||
expect(updated.masjidAddress, settings.masjidAddress);
|
||||
expect(updated.runningTexts, settings.runningTexts);
|
||||
});
|
||||
@@ -94,5 +96,25 @@ void main() {
|
||||
expect(status.cachedDays, 2);
|
||||
expect(status.daysUntilRefresh, 31);
|
||||
});
|
||||
|
||||
test('rolling window stale key helper keeps only current and next month', () {
|
||||
final staleKeys = SyncService.staleScheduleKeys(
|
||||
[
|
||||
'2026-02-28',
|
||||
'2026-03-01',
|
||||
'2026-04-30',
|
||||
'2026-05-01',
|
||||
'invalid-key',
|
||||
],
|
||||
DateTime(2026, 3, 30),
|
||||
);
|
||||
|
||||
expect(
|
||||
staleKeys,
|
||||
containsAll(<String>['2026-02-28', '2026-05-01', 'invalid-key']),
|
||||
);
|
||||
expect(staleKeys, isNot(contains('2026-03-01')));
|
||||
expect(staleKeys, isNot(contains('2026-04-30')));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user