Better tests for exporting to json

This commit is contained in:
Manuel Ebert 2013-08-06 18:10:42 -07:00
parent 1889cee6c3
commit ff0b85e28b
2 changed files with 39 additions and 42 deletions

View file

@ -4,49 +4,19 @@ Feature: Expoting a Journal
Given we use the config "tags.json"
When we run "jrnl --export json"
Then we should get no error
and the output should be
"""
{
"entries": [
{
"body": "(1) write a command line @journal software\n(2) ???\n(3) PROFIT!",
"date": "2013-04-09",
"time": "15:39",
"title": "I have an @idea:"
},
{
"body": "As alway's he shared his latest @idea on how to rule the world with me.",
"date": "2013-06-10",
"time": "15:40",
"title": "I met with @dan."
}
],
"tags": {
"@idea": 2,
"@journal": 1,
"@dan": 1
}
}
"""
and the output should be parsable as json
and "entries" in the json output should have 2 elements
and "tags" in the json output should contain "@idea"
and "tags" in the json output should contain "@journal"
and "tags" in the json output should contain "@dan"
Scenario: Exporting using filters should only export parts of the journal
Given we use the config "tags.json"
When we run "jrnl -to 'may 2013' --export json"
Then we should get no error
and the output should be
"""
{
"entries": [
{
"body": "(1) write a command line @journal software\n(2) ???\n(3) PROFIT!",
"date": "2013-04-09",
"time": "15:39",
"title": "I have an @idea:"
}
],
"tags": {
"@idea": 1,
"@journal": 1
}
}
"""
# Then we should get no error
Then the output should be parsable as json
and "entries" in the json output should have 1 element
and "tags" in the json output should contain "@idea"
and "tags" in the json output should contain "@journal"
and "tags" in the json output should not contain "@dan"