standardize behave tests

This commit is contained in:
Jonathan Wren 2020-07-06 23:08:30 -07:00
parent 6b73eb786e
commit 131477c7e3
No known key found for this signature in database
GPG key ID: 43D5FF8722E7F68A
15 changed files with 291 additions and 309 deletions

View file

@ -4,7 +4,7 @@ Feature: Dayone specific implementation details.
Given we use the config "dayone.yaml"
When we run "jrnl -from 'feb 2013'"
Then we should get no error
and the output should be
And the output should be
"""
2013-05-17 11:39 This entry has tags!
@ -19,16 +19,13 @@ Feature: Dayone specific implementation details.
Given we use the config "dayone.yaml"
When we run "jrnl -until 'feb 2013'"
Then we should get no error
and the output should contain "2013-01-17T18:37Z" in the local time
And the output should contain "2013-01-17T18:37Z" in the local time
Scenario: Writing into Dayone
Given we use the config "dayone.yaml"
When we run "jrnl 01 may 1979: Being born hurts."
and we run "jrnl -until 1980"
Then the output should be
"""
1979-05-01 09:00 Being born hurts.
"""
And we run "jrnl -until 1980"
Then the output should be "1979-05-01 09:00 Being born hurts."
Scenario: Loading tags from a DayOne Journal
Given we use the config "dayone.yaml"
@ -42,7 +39,7 @@ Feature: Dayone specific implementation details.
Scenario: Saving tags from a DayOne Journal
Given we use the config "dayone.yaml"
When we run "jrnl A hard day at @work"
and we run "jrnl --tags"
And we run "jrnl --tags"
Then the output should be
"""
@work : 2
@ -52,44 +49,23 @@ Feature: Dayone specific implementation details.
Scenario: Filtering by tags from a DayOne Journal
Given we use the config "dayone.yaml"
When we run "jrnl @work"
Then the output should be
"""
2013-05-17 11:39 This entry has tags!
"""
Then the output should be "2013-05-17 11:39 This entry has tags!"
Scenario: Exporting dayone to json
Given we use the config "dayone.yaml"
When we run "jrnl --export json"
Then we should get no error
and the output should be parsable as json
and the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1"
And the output should be parsable as json
And the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1"
Scenario: Writing into Dayone adds extended metadata
Given we use the config "dayone.yaml"
When we run "jrnl 01 may 1979: Being born hurts."
and we run "jrnl --export json"
And we run "jrnl --export json"
Then "entries" in the json output should have 5 elements
and the json output should contain entries.0.creator.software_agent
and the json output should contain entries.0.creator.os_agent
and the json output should contain entries.0.creator.host_name
and the json output should contain entries.0.creator.generation_date
and the json output should contain entries.0.creator.device_agent
and "entries.0.creator.software_agent" in the json output should contain "jrnl"
Scenario: Editing Dayone with mock editor
Given we use the config "dayone.yaml"
When we run "jrnl --edit"
Then we should get no error
Scenario: Editing Dayone entries
Given we use the config "dayone.yaml"
When we open the editor and append
"""
Here is the first line.
Here is the second line.
"""
When we run "jrnl -n 1"
Then we should get no error
and the output should contain "This entry is starred!"
and the output should contain "Here is the first line"
and the output should contain "Here is the second line"
And the json output should contain entries.0.creator.software_agent
And the json output should contain entries.0.creator.os_agent
And the json output should contain entries.0.creator.host_name
And the json output should contain entries.0.creator.generation_date
And the json output should contain entries.0.creator.device_agent
And "entries.0.creator.software_agent" in the json output should contain "jrnl"