From 96637388432e97b643b4d6c573dc3bb49b7859a4 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Tue, 17 Nov 2026 22:11:23 +0100 Subject: [PATCH] Make the real-clock test time-independent Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WzxdWZHWP4KZ6x5TcXDBFC --- app/pubspec.yaml | 2 +- app/test/services/due_slot_check_test.dart | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 101cc7b..cf5dfb3 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -2,7 +2,7 @@ name: diet_guard_app description: "Companion phone app for diet_guard: log meals on the go." publish_to: 'none' -version: 1.0.176+1 +version: 1.0.177+1 environment: sdk: ^3.12.2 diff --git a/app/test/services/due_slot_check_test.dart b/app/test/services/due_slot_check_test.dart index 9af6873..34ee090 100644 --- a/app/test/services/due_slot_check_test.dart +++ b/app/test/services/due_slot_check_test.dart @@ -115,13 +115,10 @@ void main() { }); test('uses the real clock when now is omitted', () async { - // Just exercises the `now ?? DateTime.now()` branch without asserting - // on specific slots (which depend on the actual time the test runs). - await checkAndNotify(); - expect( - notificationLog.where((c) => c.method == 'show' || c.method == 'cancel'), - isNotEmpty, - ); + // Just exercises the `now ?? DateTime.now()` branch. Whether anything is + // shown or cancelled depends on the wall clock (nothing is due after the + // last slot's cutoff), so only completion is asserted. + await expectLater(checkAndNotify(), completes); }); test('still syncs when nothing is due', () async {