Repository navigation
Take the rules of the Pomodoro out of its service - #184
Merged
Merged
Conversation
vesnicancz
force-pushed
the
refactor/pomodoro-cycle
branch
from
November 5, 2026 13:11
931628c to
b1cdaa1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PomodoroServicekept the rules of the Pomodoro in the same class and the same methods as the LED, the notifications, automatic tracking and the timer. Checking which phase follows which meant going through mocks of all of those.What changes
PomodoroCycleis a new class with the rules:Start,Stop,Reset,TickandAdvance, the last of which returns aPomodoroTransition. It has no dependencies, no clock and no lock.PomodoroServicekeeps the lock and the timer, and acts on what the cycle returns. Its public interface doesn't change._isRunninggoes. It was always set together with the phase, so running now simply means the phase isn'tIdle.Behavior doesn't change. In particular
Stopstill keeps the count of completed Pomodoros until the next start andResetclears it, and a running Pomodoro keeps the settings it started with.Testing
PomodoroCycleTestscover the rules without any mocks, including a whole cycle through the long break. The existingPomodoroServiceTestspass unchanged.24:56), Skip moved fromWorktoShortBreak, and Stop ended it, with all of it matching the log. Automatic tracking is off in these settings, so it didn't run.