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 Feature: Importing data
Scenario Outline: --import allows new entry from stdin 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 And we use the password "test" if prompted
When we run "jrnl --import" and pipe "[2020-07-05 15:00] Observe and import." When we run "jrnl --import" and pipe "[2020-07-05 15:00] Observe and import."
Then we flush the output Then we flush the output
@ -9,50 +9,44 @@ Feature: Importing data
Then the output should contain "Observe and import" Then the output should contain "Observe and import"
Examples: Configs Examples: Configs
| config | | config_file |
| basic_onefile | | basic_onefile.yaml |
| basic_encrypted | | basic_encrypted.yaml |
# | basic_folder | @todo # | basic_folder.yaml | @todo
# | basic_dayone | @todo # | basic_dayone.yaml | @todo
Scenario Outline: --import allows new large entry from stdin 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 And we use the password "test" if prompted
When we run "jrnl --import" and pipe When we run "jrnl --import" and pipe
""" [2020-07-05 15:00] Observe and import.
[2020-07-05 15:00] Observe and import. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu consequat.
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
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
tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at dolor dui end of entry.
dolor dui end of entry.
"""
Then we flush the output
When we run "jrnl -on 2020-07-05" When we run "jrnl -on 2020-07-05"
Then the output should contain "2020-07-05 15:00 Observe and import." 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 "Lorem ipsum"
And the output should contain "end of entry." And the output should contain "end of entry."
Examples: Configs Examples: Configs
| config | | config |
| basic_onefile | | basic_onefile.yaml |
| basic_encrypted | | basic_encrypted.yaml |
# | basic_folder | @todo # | basic_folder.yaml | @todo
# | basic_dayone | @todo # | basic_dayone.yaml | @todo
Scenario Outline: --import allows multiple new entries from stdin 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 And we use the password "test" if prompted
When we run "jrnl --import" and pipe When we run "jrnl --import" and pipe
""" [2020-07-05 15:00] Observe and import.
[2020-07-05 15:00] Observe and import. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
[2020-07-05 15:01] Twice as nice. [2020-07-05 15:01] Twice as nice.
Sed dignissim sed nisl eu consequat. Sed dignissim sed nisl eu consequat.
"""
Then we flush the output
When we run "jrnl -on 2020-07-05" When we run "jrnl -on 2020-07-05"
Then the output should contain "2020-07-05 15:00 Observe and import." 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 "Lorem ipsum"
@ -60,34 +54,36 @@ Feature: Importing data
And the output should contain "Sed dignissim" And the output should contain "Sed dignissim"
Examples: Configs Examples: Configs
| config | | config |
| basic_onefile | | basic_onefile.yaml |
| basic_encrypted | | basic_encrypted.yaml |
# | basic_folder | @todo # | basic_folder.yaml | @todo
# | basic_dayone | @todo # | basic_dayone.yaml | @todo
Scenario: --import allows import new entries from file Scenario: --import allows import new entries from file
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
Then the journal should contain "My first entry." When we run "jrnl -99"
And the journal should contain "Life is good." Then the output should contain "My first entry."
But the journal should not contain "I have an @idea" And the output should contain "Life is good."
And the journal should not contain "I met with" 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" When we run "jrnl --import --file features/journals/tags.journal"
Then the journal should contain "My first entry." And we run "jrnl -99"
And the journal should contain "Life is good." Then the output should contain "My first entry."
And the journal should contain "PROFIT!" 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 Scenario: --import prioritizes --file over pipe data if both are given
Given we use the config "simple.yaml" Given we use the config "simple.yaml"
Then the journal should contain "My first entry." When we run "jrnl -99"
And the journal should contain "Life is good." Then the output should contain "My first entry."
But the journal should not contain "I have an @idea" And the output should contain "Life is good."
And the journal should not contain "I met with" 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 When we run "jrnl --import --file features/journals/tags.journal" and pipe
""" [2020-07-05 15:00] 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."
Then the journal should contain "My first entry." And the output should contain "PROFIT!"
And the journal should contain "PROFIT!" But the output should not contain "I should not exist!"
But the journal should not contain "I should not exist!"

View file

@ -2,20 +2,32 @@ Feature: Multiple journals
Scenario: Loading a config with two journals Scenario: Loading a config with two journals
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
Then journal "default" should have 2 entries When we run "jrnl -99 --short"
And journal "work" should have 0 entries 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 Scenario: Write to default config by default
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl this goes to default" When we run "jrnl this goes to default"
Then journal "default" should have 3 entries When we run "jrnl -99 --short"
And journal "work" should have 0 entries 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 Scenario: Write to specified journal
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl work a long day in the office" When we run "jrnl work a long day in the office"
Then journal "default" should have 2 entries When we run "jrnl -99 --short"
And journal "work" should have 1 entry 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 Scenario: Tell user which journal was used
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
@ -25,41 +37,49 @@ Feature: Multiple journals
Scenario: Write to specified journal with a timestamp Scenario: Write to specified journal with a timestamp
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl work 23 july 2012: a long day in the office" When we run "jrnl work 23 july 2012: a long day in the office"
Then journal "default" should have 2 entries When we run "jrnl -99 --short"
And journal "work" should have 1 entry Then the output should be
And journal "work" should contain "2012-07-23" @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 Scenario: Write to specified journal without a timestamp but with colon
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl work : a long day in the office" When we run "jrnl work : a long day in the office"
Then journal "default" should have 2 entries Then the output should be
And journal "work" should have 1 entry @todo something
And journal "work" should contain "a long day in the office" 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 Scenario: Write to specified journal without a timestamp but with colon
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl work: a long day in the office" When we run "jrnl work: a long day in the office"
Then journal "default" should have 2 entries When we run "jrnl -99 --short"
And journal "work" should have 1 entry Then the output should be
And journal "work" should contain "a long day in the office" @todo something
When we run "jrnl work -99 --short"
Then the output should be
@todo something
Scenario: Create new journals as required Scenario: Create new journals as required
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
Then journal "ideas" should not exist Then journal "ideas" should not exist
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money" 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 Scenario: Don't crash if no default journal is specified
Given we use the config "bug343.yaml" Given we use the config "bug343.yaml"
When we run "jrnl a long day in the office" 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 Scenario: Don't crash if no file exists for a configured encrypted journal
Given we use the config "multiple.yaml" Given we use the config "multiple.yaml"
When we run "jrnl new_encrypted Adding first entry" and enter When we run "jrnl new_encrypted Adding first entry" and enter
""" these three eyes
these three eyes these three eyes
these three eyes n
n Then the output should contain "Encrypted journal 'new_encrypted' created"
"""
Then we should see the message "Encrypted journal 'new_encrypted' created"