mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Update tests to use more scenario outlines
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
3d29b6b6a1
commit
e0980cf396
2 changed files with 91 additions and 75 deletions
|
@ -1,7 +1,7 @@
|
|||
Feature: Importing data
|
||||
|
||||
Scenario Outline: --import allows new entry from stdin
|
||||
Given we use the config "<config>.yaml"
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe "[2020-07-05 15:00] Observe and import."
|
||||
Then we flush the output
|
||||
|
@ -9,17 +9,16 @@ Feature: Importing data
|
|||
Then the output should contain "Observe and import"
|
||||
|
||||
Examples: Configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
# | basic_folder | @todo
|
||||
# | basic_dayone | @todo
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario Outline: --import allows new large entry from stdin
|
||||
Given we use the config "<config>.yaml"
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe
|
||||
"""
|
||||
[2020-07-05 15:00] Observe and import.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
|
||||
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
|
||||
|
@ -27,8 +26,6 @@ Feature: Importing data
|
|||
Aenean ante ex, elementum ut interdum et, mattis eget lacus. In commodo nulla nec
|
||||
tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at
|
||||
dolor dui end of entry.
|
||||
"""
|
||||
Then we flush the output
|
||||
When we run "jrnl -on 2020-07-05"
|
||||
Then the output should contain "2020-07-05 15:00 Observe and import."
|
||||
And the output should contain "Lorem ipsum"
|
||||
|
@ -36,23 +33,20 @@ Feature: Importing data
|
|||
|
||||
Examples: Configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
# | basic_folder | @todo
|
||||
# | basic_dayone | @todo
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario Outline: --import allows multiple new entries from stdin
|
||||
Given we use the config "<config>.yaml"
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe
|
||||
"""
|
||||
[2020-07-05 15:00] Observe and import.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
[2020-07-05 15:01] Twice as nice.
|
||||
Sed dignissim sed nisl eu consequat.
|
||||
"""
|
||||
Then we flush the output
|
||||
When we run "jrnl -on 2020-07-05"
|
||||
Then the output should contain "2020-07-05 15:00 Observe and import."
|
||||
And the output should contain "Lorem ipsum"
|
||||
|
@ -61,33 +55,35 @@ Feature: Importing data
|
|||
|
||||
Examples: Configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
# | basic_folder | @todo
|
||||
# | basic_dayone | @todo
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario: --import allows import new entries from file
|
||||
Given we use the config "simple.yaml"
|
||||
Then the journal should contain "My first entry."
|
||||
And the journal should contain "Life is good."
|
||||
But the journal should not contain "I have an @idea"
|
||||
And the journal should not contain "I met with"
|
||||
When we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "Life is good."
|
||||
But the output should not contain "I have an @idea"
|
||||
And the output should not contain "I met with"
|
||||
When we run "jrnl --import --file features/journals/tags.journal"
|
||||
Then the journal should contain "My first entry."
|
||||
And the journal should contain "Life is good."
|
||||
And the journal should contain "PROFIT!"
|
||||
And we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "Life is good."
|
||||
And the output should contain "PROFIT!"
|
||||
|
||||
Scenario: --import prioritizes --file over pipe data if both are given
|
||||
Given we use the config "simple.yaml"
|
||||
Then the journal should contain "My first entry."
|
||||
And the journal should contain "Life is good."
|
||||
But the journal should not contain "I have an @idea"
|
||||
And the journal should not contain "I met with"
|
||||
When we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "Life is good."
|
||||
But the output should not contain "I have an @idea"
|
||||
And the output should not contain "I met with"
|
||||
When we run "jrnl --import --file features/journals/tags.journal" and pipe
|
||||
"""
|
||||
[2020-07-05 15:00] I should not exist!
|
||||
"""
|
||||
Then the journal should contain "My first entry."
|
||||
And the journal should contain "PROFIT!"
|
||||
But the journal should not contain "I should not exist!"
|
||||
And we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "PROFIT!"
|
||||
But the output should not contain "I should not exist!"
|
||||
|
||||
|
|
|
@ -2,20 +2,32 @@ Feature: Multiple journals
|
|||
|
||||
Scenario: Loading a config with two journals
|
||||
Given we use the config "multiple.yaml"
|
||||
Then journal "default" should have 2 entries
|
||||
And journal "work" should have 0 entries
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Write to default config by default
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl this goes to default"
|
||||
Then journal "default" should have 3 entries
|
||||
And journal "work" should have 0 entries
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Write to specified journal
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work a long day in the office"
|
||||
Then journal "default" should have 2 entries
|
||||
And journal "work" should have 1 entry
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Tell user which journal was used
|
||||
Given we use the config "multiple.yaml"
|
||||
|
@ -25,41 +37,49 @@ Feature: Multiple journals
|
|||
Scenario: Write to specified journal with a timestamp
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work 23 july 2012: a long day in the office"
|
||||
Then journal "default" should have 2 entries
|
||||
And journal "work" should have 1 entry
|
||||
And journal "work" should contain "2012-07-23"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Write to specified journal without a timestamp but with colon
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work : a long day in the office"
|
||||
Then journal "default" should have 2 entries
|
||||
And journal "work" should have 1 entry
|
||||
And journal "work" should contain "a long day in the office"
|
||||
Then the output should be
|
||||
@todo something
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Write to specified journal without a timestamp but with colon
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work: a long day in the office"
|
||||
Then journal "default" should have 2 entries
|
||||
And journal "work" should have 1 entry
|
||||
And journal "work" should contain "a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Create new journals as required
|
||||
Given we use the config "multiple.yaml"
|
||||
Then journal "ideas" should not exist
|
||||
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money"
|
||||
Then journal "ideas" should have 1 entry
|
||||
When we run "jrnl ideas -99 --short"
|
||||
Then the output should be
|
||||
@todo something
|
||||
|
||||
Scenario: Don't crash if no default journal is specified
|
||||
Given we use the config "bug343.yaml"
|
||||
When we run "jrnl a long day in the office"
|
||||
Then we should see the message "No default journal configured"
|
||||
Then the output should contain "No default journal configured"
|
||||
|
||||
Scenario: Don't crash if no file exists for a configured encrypted journal
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl new_encrypted Adding first entry" and enter
|
||||
"""
|
||||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
"""
|
||||
Then we should see the message "Encrypted journal 'new_encrypted' created"
|
||||
Then the output should contain "Encrypted journal 'new_encrypted' created"
|
||||
|
|
Loading…
Add table
Reference in a new issue