Skip to content

#1418 Add regression tests for missed automatically taken reminders - #1648

Open
fpMiguel wants to merge 2 commits into
Futsch1:mainfrom
fpMiguel:1418-battery-dead-missing-medications
Open

#1418 Add regression tests for missed automatically taken reminders#1648
fpMiguel wants to merge 2 commits into
Futsch1:mainfrom
fpMiguel:1418-battery-dead-missing-medications

Conversation

@fpMiguel

Copy link
Copy Markdown

Summary

Regression tests for #1418 ("Battery dead = missing medications"). When the phone is
off at the time an automatically taken dose is due, that dose should still be recorded
as taken. The behavior already exists on main (fix e657feb2, December 2025, which
predates the issue). This PR adds tests so it cannot break unnoticed.

No production code changes.

Changes

  • MissedAutomaticallyTakenReminderTest (JVM / Robolectric, new): three scenarios.
    A missed automatically taken reminder is caught up and recorded as TAKEN. A missed
    reminder without that flag is raised instead. A reminder that fires right on time
    behaves correctly. This is the first JVM test for the catch-up path; nothing on main
    covered it before.
  • MissedAutomaticallyTakenInstrumentedTest (instrumented, new): the scenario from
    the issue, end to end on a device. An automatically taken reminder with a past time is
    caught up and shown as taken in the overview, and no "taken" action stays in the
    notification shade. This complements NotificationTest.automaticallyTakenTest, which
    fires at a future time.
  • TestReminderContext fake fix: the create() stub returned a Long where the
    repository interface declares ReminderEvent. Any test using that path crashed. No
    existing test hit it; the new one did.

Testing

  • JVM: MissedAutomaticallyTakenReminderTest, 3/3 green. Also verified from a clean
    checkout of main with the fake fix applied.
  • Instrumented (Android 16 emulator, API 36): the new test passes 1/1, and the existing
    NotificationTest.automaticallyTakenTest passes 1/1 on the same code.
  • Test data is synthetic ("Test med").

AI was used to create this pull request

* reminder falls due. On the next app reschedule/start, the missed dose must be
* caught up and recorded as TAKEN - not left pending and not raised for a manual action.
*
* End-to-end on the device (frozen-clock harness): an automatically-taken reminder whose

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not nail the actual issue and code path which is taken when the device is off. In this case, a special routine is triggered that is called when the Android device is restarted. This cannot be tested via AndroidTest, since it would have to reboot the device (or I am not aware about how to do it). The test you added is no regression test for the referenced issue.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the cases tested here are already covered by other tests. I am sorry, but I do not see additional value in this test...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants