Allow custom file extensions for directory journal

This commit is contained in:
Thibaud Chupin 2024-03-23 19:50:41 +01:00
parent c8c49b1ba2
commit 6b742fd412
6 changed files with 43 additions and 11 deletions

View file

@ -10,6 +10,13 @@ Feature: Journals iteracting with the file system in a way that users can see
And the journal directory should contain
2013/07/23.txt
Scenario: Adding entries to a Folder journal with a custom extension should generate date files
Given we use the config "empty_folder_with_extension.yaml"
When we run "jrnl 23 July 2013: Testing folder journal."
Then we should get no error
And the journal directory should contain
2013/07/23.md
Scenario: Adding multiple entries to a Folder journal should generate multiple date files
Given we use the config "empty_folder.yaml"
When we run "jrnl 23 July 2013: Testing folder journal."

View file

@ -0,0 +1,13 @@
default_hour: 9
default_minute: 0
editor: ''
template: false
encrypt: false
extension: .md
highlight: true
journals:
default: features/journals/empty_folder_with_extension/
linewrap: 80
tagsymbols: '@'
timeformat: '%Y-%m-%d %H:%M'
indent_character: "|"

View file

@ -51,7 +51,7 @@ def test_get_day_files_expected_filtering(inputs_and_outputs):
mock.patch("pathlib.Path.glob", return_value=glob_files),
mock.patch.object(pathlib.Path, "is_file", return_value=True),
):
actual_output = list(Folder._get_day_files(year_month_path))
actual_output = list(Folder._get_day_files(year_month_path, ".txt"))
actual_output.sort()
expected_output.sort()