mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-27 21:16:14 +02:00
Allow combinations of --change-time
, --delete
, and --edit
while correctly counting the number of entries affected (#1669)
* Remove search mode conditional that added explicit tag search behavior * Fix failing change-time test by using same method signature as base journal class * Fix user input mock - was not appropriately checking return value * Clean up controller - streamline `run` function in `controller.py` - add debug logging - fix unnecessary import of Journal class (only needed for typing) - standardize summary display across different actions * Add currently-failing test conditions for count messages when changing time and deleting * Don't show summary if no entries found and prevent extra line break when no entries found by short-circuiting display method * Track found entry count and remove incorrect modified stat logic * Track journal entry deletion consistently * Remove unneeded exception when editor is empty and fix test that was testing incorrect message * Correct entry edit modified count test * Track modification of entries with --change-time * Preserve existing behavior when editor is empty but make the message more clear * Reconcile tests with new error message when clearing editor in edit mode * Add found/modified counts to edit tests * Add tests for found count with -n equivalent argument * Test combinations of found/deleted messages when using --delete * Add tests for counting combinations of action arguments (change-time, edit, delete) and for change-time counts. Some are failing and should be investigated * Remove extraneous comment in test * Track added/deleted counts in a register in the Journal class instead of attempting to infer it via controller counting * Add encrypted to more tests * Fix merge conflict typo * Change 'write mode' -> 'append mode' in more places --------- Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
b3c6f90a35
commit
3c923ae943
18 changed files with 474 additions and 265 deletions
|
@ -76,21 +76,21 @@ Feature: Writing new entries.
|
|||
| basic_dayone.yaml |
|
||||
| basic_folder.yaml |
|
||||
|
||||
Scenario Outline: Writing an empty entry from the editor should yield "No entry to save" message
|
||||
Scenario Outline: Clearing the editor's contents should yield "No text received" message
|
||||
Given we use the config "<config_file>"
|
||||
And we write nothing to the editor if opened
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --edit"
|
||||
Then the error output should contain "No entry to save, because no text was received"
|
||||
Then the error output should contain "No text received from editor. Were you trying to delete all the entries?"
|
||||
And the editor should have been called
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| editor.yaml |
|
||||
| editor_empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_onefile.yaml |
|
||||
| config_file |
|
||||
| editor.yaml |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_dayone.yaml |
|
||||
| basic_folder.yaml |
|
||||
|
||||
Scenario Outline: Writing an empty entry from the command line should yield "No entry to save" message
|
||||
Given we use the config "<config_file>"
|
||||
|
@ -236,7 +236,9 @@ Feature: Writing new entries.
|
|||
And we append to the editor if opened
|
||||
[2021-11-13] worked on jrnl tests
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain "1 entry added"
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "1 entry added"
|
||||
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -254,7 +256,8 @@ Feature: Writing new entries.
|
|||
[2021-11-12] worked on jrnl tests again
|
||||
[2021-11-13] worked on jrnl tests a little bit more
|
||||
When we run "jrnl --edit"
|
||||
Then the error output should contain "3 entries added"
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "3 entries added"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -271,7 +274,7 @@ Feature: Writing new entries.
|
|||
[2021-11-13] I am replacing my whole journal with this entry
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain "2 entries deleted"
|
||||
Then the output should contain "3 entries modified"
|
||||
And the output should contain "1 entry modified"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -287,8 +290,7 @@ Feature: Writing new entries.
|
|||
And we write to the editor if opened
|
||||
[2021-11-13] I am replacing the last entry with this entry
|
||||
When we run "jrnl --edit -1"
|
||||
Then the output should contain
|
||||
1 entry modified
|
||||
Then the error output should contain "1 entry modified"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -304,8 +306,8 @@ Feature: Writing new entries.
|
|||
And we append to the editor if opened
|
||||
This is a small addendum to my latest entry.
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain
|
||||
1 entry modified
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "1 entry modified"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -341,6 +343,7 @@ Feature: Writing new entries.
|
|||
And we append to the editor if opened
|
||||
@newtag
|
||||
When we run "jrnl --edit -1"
|
||||
Then the error output should contain "1 entry modified"
|
||||
When we run "jrnl --tags @newtag"
|
||||
Then the output should contain
|
||||
1 entry found
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue