Files
werkjournal/gherkin/habit-tests.feature
claude-code 0aa2767d45
werkator/jvm build succeeded after 09:39
Give habits an inner and an outer level of limits (#7)
Each habit limit gets an inner level (yellow) and an outer level (red); existing limits become the inner ones. Plan in werkjournal.werkbaum #habit-limit-levels, scenarios WJ-067 to WJ-072.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #7
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-13 12:07:54 +02:00

132 lines
5.0 KiB
Gherkin

Feature: Daily habit counts and historical weekly limits
@WJ-001 @browser
Scenario: Count without a configured limit
Given Alice has never configured a weekly limit
When she adds a habit for today
Then the weekly consumption is shown
And no remaining allowance or limit warning is shown
@WJ-002 @service
Scenario: A habit count cannot become negative
Given today's habit count is zero
When Alice requests a decrement
Then the stored count remains zero
@WJ-003 @service
Scenario: Concurrent increments report a conflict
Given two devices have loaded today's count of 2 at the same version
When the first device increments the count
And the second device increments using the old version
Then the stored count is 3
And the second device is shown a conflict and the current count
And no automatic retry is made
@WJ-004 @service
Scenario: Change the allowance for the current week only onward
Given last week's allowance was 4
And this week's allowance is 4
When Alice changes the allowance to 2 this Wednesday
Then this entire Monday-to-Sunday week has allowance 2
And future weeks use allowance 2 until another change
And last week's allowance remains 4
@WJ-005 @browser
Scenario: Record a habit above the allowance
Given Alice has consumed her weekly allowance
When she adds one habit
Then the habit is saved without an extra confirmation
And the weekly display states that she is one habit over the limit
@WJ-006 @browser
Scenario: Calculate a week spanning two months
Given a Monday-to-Sunday week overlaps two months
When Alice views either month's calendar
Then that week's total includes all seven calendar dates
And the effective limit for that week is displayed
@WJ-007 @browser
Scenario: Record work on a day off
Given Alice marked today as a day off
When she saves 3 hours of work for today
Then the work is included in her totals
And the day-off marker remains set
And no work reminder is due for today
@WJ-008 @browser
Scenario: Disable a tracker without deleting its data
Given Alice has work entries and enabled work reminders
When she disables the work tracker
Then its dashboard section is hidden
And all her work reminders are disabled
And her work entries remain available for export
@WJ-009 @service
Scenario: The first allowance does not change earlier weeks
Given Alice has never configured a weekly allowance
When she sets an allowance of zero this Wednesday
Then the current week has allowance zero
And earlier weeks still have no allowance
And she can still record habit counts
@WJ-056 @service
Scenario: All four boundaries are advisory
Given a habit has daily minimum 2 and maximum 3
And weekly minimum 5 and maximum 6
When Alice sets today's count to 20
Then the count is saved
And both maximum violations are indicated
When Alice sets today's count to 1
Then the count is saved
And both minimum shortfalls are indicated
@WJ-057 @service
Scenario: Initial habits remain ordinary editable data
Given Alice opens her account for the first time
Then customer Allgemein with project Allgemein is available
And Reading and Walks each have daily minimum 1 and weekly minimum 5
And neither has a maximum
When Alice deactivates both habits
And opens the application again
Then no active habits are shown
@WJ-067 @service
Scenario: Crossing the inner limit asks for attention
Given a habit has daily maximum 2 and outer daily maximum 4
When Alice sets today's count to 3
Then the count is saved
And the maximum violation is indicated as attention, not as severe
@WJ-068 @service
Scenario: Crossing the outer limit is severe
Given a habit has weekly minimum 5 and outer weekly minimum 3
When Alice's week ends with a total of 2
Then the minimum shortfall is indicated as severe
@WJ-069 @service
Scenario: The outer limits enclose the inner ones
Given Alice edits a habit
When she sets the outer daily minimum 3 above the daily minimum 2
Then the limits are refused as invalid
And the previous limits stay in effect
@WJ-070 @service
Scenario: Limits set before the outer level are inner limits
Given a habit had weekly minimum 5 before the outer limits existed
When the database is migrated
Then the habit has weekly minimum 5 as its inner limit
And no outer limit
@WJ-071 @service
Scenario: An export carries the outer limits
Given a habit has daily maximum 2 and outer daily maximum 4
When Alice exports the month and imports the file into another journal
Then the habit there has daily maximum 2 and outer daily maximum 4
@WJ-072 @browser
Scenario: The two levels show yellow and red
Given Alice created a habit with daily maximum 2 and outer daily maximum 4 in the dialog
When she counts 3 today
Then the count is shown in yellow
When she counts 5 today
Then the count is shown in red