fix: harden reminders and state handling

This commit is contained in:
Codex
2026-06-06 02:27:04 +07:00
parent ad000c722e
commit ffe80b62c4
17 changed files with 1752 additions and 288 deletions

View File

@@ -186,6 +186,21 @@ describe('checkDueExercises gating', () => {
expect(h.updateExercise).toHaveBeenCalled()
})
it('dailyGoal использует reps snapshot из истории, а не текущие reps упражнения', async () => {
h.exercises = [makeExercise({ reps: 25, dailyGoal: 20 })]
h.history = [
{
ts: Date.now(),
exerciseId: 'ex1',
action: 'done',
reps: 10
}
]
const { forceCheck } = await loadScheduler()
forceCheck()
expect(h.fireReminder).toHaveBeenCalledTimes(1)
})
it('adaptive: применяет adjustNextFireAt к кандидату', async () => {
h.exercises = [makeExercise({ adaptive: true })]
const { forceCheck } = await loadScheduler()