Update tests to use more scenario outlines

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2021-04-24 15:26:13 -07:00
parent 3d29b6b6a1
commit e0980cf396
2 changed files with 91 additions and 75 deletions

View file

@ -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,50 +9,44 @@ 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
et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu consequat.
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
[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
et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu consequat.
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.
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"
And the output should contain "end of entry."
Examples: Configs
| config |
| basic_onefile |
| basic_encrypted |
# | basic_folder | @todo
# | basic_dayone | @todo
| config |
| 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: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
[2020-07-05 15:01] Twice as nice.
Sed dignissim sed nisl eu consequat.
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"
@ -60,34 +54,36 @@ Feature: Importing data
And the output should contain "Sed dignissim"
Examples: Configs
| config |
| basic_onefile |
| basic_encrypted |
# | basic_folder | @todo
# | basic_dayone | @todo
| config |
| 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!"
[2020-07-05 15:00] 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!"

View file

@ -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"
these three eyes
these three eyes
n
Then the output should contain "Encrypted journal 'new_encrypted' created"