Implement JSON tests and remove "node" nomenclature from tests

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
Micah Jerome Ellison 2021-04-10 15:26:26 -07:00 committed by Jonathan Wren
parent 48c9d9fa16
commit 430182a0a5
2 changed files with 32 additions and 15 deletions

View file

@ -7,15 +7,15 @@ Feature: Custom formats
Then we should get no error
And the output should be valid JSON
Given we parse the output as JSON
Then "entries" node in the parsed output should have 3 elements
Then "entries" in the parsed output should have 3 elements
And "tags" in the parsed output should be
@ipsum
@tagone
@tagtwo
@tagthree
And entry 1 should have an array "tags" with 3 elements
And entry 2 should have an array "tags" with 1 elements
And entry 3 should have an array "tags" with 2 elements
And "entries.0.tags" in the parsed output should have 3 elements
And "entries.1.tags" in the parsed output should have 1 elements
And "entries.2.tags" in the parsed output should have 2 elements
Examples: configs
| config_file |
@ -24,12 +24,14 @@ Feature: Custom formats
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario: Exporting dayone to json
Scenario: Exporting dayone to json should include UUID
Given we use the config "dayone.yaml"
When we run "jrnl --export json"
Then we should get no error
And the output should be valid JSON
And the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1"
Given we parse the output as JSON
Then "entries.0.uuid" in the parsed output should be
4BB1F46946AD439996C9B59DE7C4DDC1
Scenario Outline: Printing a journal that has multiline entries with tags
Given we use the config "<config_file>"
@ -248,7 +250,7 @@ Feature: Custom formats
And we use the password "test" if prompted
When we run "jrnl --export xml"
Then the output should be a valid XML string
And "entries" node in the xml output should have 3 elements
And "entries" in the xml output should have 3 elements
And "tags" in the xml output should contain
@ipsum
@tagone
@ -269,7 +271,7 @@ Feature: Custom formats
When we run "jrnl --export xml"
Then the output should be valid XML
Given we parse the output as XML
Then "entries" node in the parsed output should have 2 elements
Then "entries" in the parsed output should have 2 elements
And "tags" in the parsed output should be
@idea
@journal