mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-01 22:56:12 +02:00
Add calendar export test scaffolding
This commit is contained in:
parent
0a2f040a9e
commit
1fa091d7dc
2 changed files with 20 additions and 1 deletions
|
@ -39,6 +39,7 @@ class CalendarHeatmapExporter(TextExporter):
|
|||
curr_year = datetime.now().year
|
||||
curr_month = datetime.now().month
|
||||
curr_day = datetime.now().day
|
||||
hit_first_entry = False
|
||||
with console.capture() as capture:
|
||||
for year, month_journaling_freq in journal_frequency.items():
|
||||
year_calendar = []
|
||||
|
@ -47,7 +48,12 @@ class CalendarHeatmapExporter(TextExporter):
|
|||
break
|
||||
|
||||
entries_this_month = sum(month_journaling_freq[month].values())
|
||||
if entries_this_month == 0:
|
||||
if not hit_first_entry and entries_this_month > 0:
|
||||
hit_first_entry = True
|
||||
|
||||
if entries_this_month == 0 and not hit_first_entry:
|
||||
continue
|
||||
elif entries_this_month == 0:
|
||||
entry_msg = "No entries"
|
||||
elif entries_this_month == 1:
|
||||
entry_msg = "1 entry"
|
||||
|
|
|
@ -565,6 +565,19 @@ Feature: Custom formats
|
|||
| basic_dayone.yaml |
|
||||
|
||||
|
||||
Scenario Outline: Export calendar heatmap
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --format calendar"
|
||||
Then the output should be
|
||||
2013-06-09, 1
|
||||
2013-06-10, 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
|
||||
|
||||
Scenario Outline: display_format short and pretty do not crash if specified as config values
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue