mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 13:08:31 +02:00
update more tests
This commit is contained in:
parent
9116b63d8a
commit
7368cd61cc
7 changed files with 372 additions and 112 deletions
|
@ -5,7 +5,7 @@ colors:
|
|||
tags: none
|
||||
default_hour: 9
|
||||
default_minute: 0
|
||||
editor: ""
|
||||
editor: noop
|
||||
encrypt: false
|
||||
highlight: true
|
||||
journals:
|
||||
|
|
|
@ -5,7 +5,7 @@ colors:
|
|||
tags: none
|
||||
default_hour: 9
|
||||
default_minute: 0
|
||||
editor: ""
|
||||
editor: noop
|
||||
encrypt: true
|
||||
highlight: true
|
||||
journals:
|
||||
|
|
|
@ -5,7 +5,7 @@ colors:
|
|||
tags: none
|
||||
default_hour: 9
|
||||
default_minute: 0
|
||||
editor: ""
|
||||
editor: noop
|
||||
encrypt: false
|
||||
highlight: true
|
||||
journals:
|
||||
|
|
|
@ -5,7 +5,7 @@ colors:
|
|||
tags: none
|
||||
default_hour: 9
|
||||
default_minute: 0
|
||||
editor: ""
|
||||
editor: noop
|
||||
encrypt: false
|
||||
highlight: true
|
||||
journals:
|
||||
|
|
|
@ -16,7 +16,7 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
Then the output should contain "2013/07/23.txt" or "2013\07\23.txt"
|
||||
Then the output should contain "2014/03/07.txt" or "2014\03\07.txt"
|
||||
|
||||
Scenario: If the journal and it's parent directory don't exist, they should be created
|
||||
Scenario: If the journal and its parent directory don't exist, they should be created
|
||||
Given we use the config "missing_directory.yaml"
|
||||
Then the journal should not exist
|
||||
When we run "jrnl This is a new entry in my journal"
|
||||
|
|
|
@ -1,19 +1,37 @@
|
|||
Feature: Custom formats
|
||||
|
||||
Scenario: JSON format
|
||||
Given we use the config "tags.yaml"
|
||||
Scenario Outline: JSON format
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --format json"
|
||||
Then we should get no error
|
||||
And the output should be parsable as json
|
||||
And "entries" in the json output should have 3 elements
|
||||
And "tags" in the json output should contain "@ipsum"
|
||||
And "tags" in the json output should contain "@tagone"
|
||||
And "tags" in the json output should contain "@tagthree"
|
||||
And "tags" in the json output should contain "@tagtwo"
|
||||
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
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
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 "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"
|
||||
And entry 1 should have an array "tags" with 2 elements
|
||||
And entry 2 should have an array "tags" with 2 elements
|
||||
And the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1"
|
||||
|
||||
Scenario Outline: Printing a journal that has multiline entries with tags
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -n 1 @ipsum"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
|
@ -41,47 +59,119 @@ Feature: Custom formats
|
|||
"""
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario: Exporting using filters should only export parts of the journal
|
||||
Given we use the config "tags.yaml"
|
||||
When we run "jrnl -until 'may 2013' --export json"
|
||||
Scenario Outline: Exporting using filters should only export parts of the journal
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -until 'August 2020' --format json"
|
||||
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"
|
||||
Then we should get no error
|
||||
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 "@ipsum"
|
||||
And "tags" in the json output should contain "@tagone"
|
||||
And "tags" in the json output should contain "@tagtwo"
|
||||
And entry 1 should have an array "tags" with 3 elements
|
||||
And entry 2 should have an array "tags" with 1 elements
|
||||
|
||||
Scenario: Exporting using custom templates
|
||||
Given we use the config "simple.yaml"
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario Outline: Exporting using custom templates
|
||||
Given we use the config "<config>.yaml"
|
||||
And we load template "sample.template"
|
||||
When we run "jrnl --export sample"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -1 --format sample"
|
||||
Then the output should be
|
||||
"""
|
||||
My first entry.
|
||||
---------------
|
||||
The third entry finally after weeks without writing.
|
||||
----------------------------------------------------
|
||||
|
||||
Everything is alright
|
||||
I'm so excited about emojis. 💯 🎶 💩
|
||||
|
||||
Life is good.
|
||||
-------------
|
||||
|
||||
But I'm better.
|
||||
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
|
||||
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. Nulla
|
||||
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
|
||||
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh malesuada.
|
||||
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
|
||||
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
|
||||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||
ante eget fringilla. @tagthree and also @tagone
|
||||
"""
|
||||
|
||||
Scenario: Increasing Headings on Markdown export
|
||||
Given we use the config "markdown-headings-335.yaml"
|
||||
When we run "jrnl --export markdown"
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario Outline: Increasing Headings on Markdown export
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we open the editor and append
|
||||
"""
|
||||
[2020-10-14 13:23] Heading Test
|
||||
|
||||
H1-1
|
||||
=
|
||||
|
||||
H1-2
|
||||
===
|
||||
|
||||
H1-3
|
||||
============================
|
||||
|
||||
H2-1
|
||||
-
|
||||
|
||||
H2-2
|
||||
---
|
||||
|
||||
H2-3
|
||||
----------------------------------
|
||||
|
||||
Horizontal Rules (ignore)
|
||||
|
||||
---
|
||||
|
||||
===
|
||||
|
||||
# ATX H1
|
||||
|
||||
## ATX H2
|
||||
|
||||
### ATX H3
|
||||
|
||||
#### ATX H4
|
||||
|
||||
##### ATX H5
|
||||
|
||||
###### ATX H6
|
||||
|
||||
Stuff
|
||||
|
||||
More stuff
|
||||
more stuff again
|
||||
"""
|
||||
Then we flush the output
|
||||
When we run "jrnl -1 --export markdown"
|
||||
Then the output should be
|
||||
"""
|
||||
# 2015
|
||||
# 2020
|
||||
|
||||
## April
|
||||
## October
|
||||
|
||||
### 2015-04-14 13:23 Heading Test
|
||||
### 2020-10-14 13:23 Heading Test
|
||||
|
||||
#### H1-1
|
||||
|
||||
|
@ -119,132 +209,280 @@ Feature: Custom formats
|
|||
more stuff again
|
||||
"""
|
||||
|
||||
# the "deletion" journal is used because it doesn't have a newline at the
|
||||
# end of the last entry
|
||||
Scenario: Add a blank line to Markdown export if there isn't one already
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
# | basic_dayone | @todo
|
||||
|
||||
Scenario Outline: Add a blank line to Markdown export if there isn't one already
|
||||
# https://github.com/jrnl-org/jrnl/issues/768
|
||||
# https://github.com/jrnl-org/jrnl/issues/881
|
||||
Given we use the config "deletion.yaml"
|
||||
When we run "jrnl --format markdown"
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we open the editor and append
|
||||
"""
|
||||
[2020-10-29 11:11] First entry.
|
||||
[2020-10-29 11:11] Second entry.
|
||||
[2020-10-29 11:13] Third entry.
|
||||
"""
|
||||
Then we flush the output
|
||||
When we run "jrnl -3 --format markdown"
|
||||
Then the output should be
|
||||
"""
|
||||
# 2019
|
||||
# 2020
|
||||
|
||||
## October
|
||||
|
||||
### 2019-10-29 11:11 First entry.
|
||||
### 2020-10-29 11:11 First entry.
|
||||
|
||||
|
||||
### 2019-10-29 11:11 Second entry.
|
||||
### 2020-10-29 11:11 Second entry.
|
||||
|
||||
|
||||
### 2019-10-29 11:13 Third entry.
|
||||
### 2020-10-29 11:13 Third entry.
|
||||
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
# | basic_dayone | @todo
|
||||
|
||||
@skip
|
||||
Scenario Outline: Exporting to XML
|
||||
Given we use the config "<config>.yaml"
|
||||
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 "tags" in the xml output should contain ["@ipsum", "@tagone", "@tagtwo", "@tagthree"]
|
||||
And there should be 10 "tag" elements
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
# | basic_onefile | @todo
|
||||
# | basic_encrypted | @todo
|
||||
# | basic_folder | @todo
|
||||
# | basic_dayone | @todo
|
||||
|
||||
Scenario: Exporting to XML
|
||||
Given we use the config "tags.yaml"
|
||||
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 2 elements
|
||||
And "tags" in the xml output should contain ["@idea", "@journal", "@dan"]
|
||||
And there should be 7 "tag" elements
|
||||
|
||||
Scenario: Exporting tags
|
||||
Given we use the config "tags.yaml"
|
||||
Scenario Outline: Exporting tags
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export tags"
|
||||
Then the output should be
|
||||
"""
|
||||
@idea : 2
|
||||
@journal : 1
|
||||
@dan : 1
|
||||
@tagtwo : 2
|
||||
@tagone : 2
|
||||
@tagthree : 1
|
||||
@ipsum : 1
|
||||
"""
|
||||
|
||||
Scenario: Exporting fancy
|
||||
Given we use the config "tags.yaml"
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
@todo
|
||||
Scenario Outline: Exporting fancy
|
||||
# Needs better emoji support
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export fancy"
|
||||
Then the output should be
|
||||
"""
|
||||
┎──────────────────────────────────────────────────────────────╮2013-04-09 15:39
|
||||
┃ I have an @idea: ╘═══════════════╕
|
||||
┎──────────────────────────────────────────────────────────────╮2020-08-29 11:11
|
||||
┃ Entry the first. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ (1) write a command line @journal software │
|
||||
┃ (2) ??? │
|
||||
┃ (3) PROFIT! │
|
||||
┃ 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. @tagone and maybe also @tagtwo. │
|
||||
┃ │
|
||||
┃ Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo │
|
||||
┃ ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. │
|
||||
┃ Suspendisse │
|
||||
┃ potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas │
|
||||
┃ eget │
|
||||
┃ molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed │
|
||||
┃ lectus │
|
||||
┃ hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis │
|
||||
┃ feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, │
|
||||
┃ vestibulum │
|
||||
┃ urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod │
|
||||
┃ enim. │
|
||||
┃ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget │
|
||||
┃ velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac │
|
||||
┃ porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per │
|
||||
┃ conubia nostra, per inceptos himenaeos. │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
┎──────────────────────────────────────────────────────────────╮2013-06-10 15:40
|
||||
┃ I met with @dan. ╘═══════════════╕
|
||||
┎──────────────────────────────────────────────────────────────╮2020-08-31 14:32
|
||||
┃ A second entry in what I hope to be a long series. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ As alway's he shared his latest @idea on how to rule the world with me. │
|
||||
┃ inst │
|
||||
┃ Sed sit amet metus et sapien feugiat elementum. Aliquam bibendum lobortis │
|
||||
┃ leo │
|
||||
┃ vitae tempus. Donec eleifend nec mi non volutpat. Lorem ipsum dolor sit │
|
||||
┃ amet, │
|
||||
┃ consectetur adipiscing elit. Praesent ut sodales libero. Maecenas nisl │
|
||||
┃ lorem, │
|
||||
┃ vestibulum in tempus sit amet, fermentum ut arcu. Donec vel vestibulum │
|
||||
┃ lectus, │
|
||||
┃ eget pretium enim. Maecenas diam nunc, imperdiet vitae pharetra sed, pretium │
|
||||
┃ id │
|
||||
┃ lectus. Donec eu metus et turpis tempor tristique ac non ex. In tellus arcu, │
|
||||
┃ egestas at efficitur et, ultrices vel est. Sed commodo et nibh non │
|
||||
┃ elementum. │
|
||||
┃ Mauris tempus vitae neque vel viverra. @tagtwo all by its lonesome. │
|
||||
┃ │
|
||||
┃ Nulla mattis elementum magna, viverra pretium dui fermentum et. Cras vel │
|
||||
┃ vestibulum odio. Quisque sit amet turpis et urna finibus maximus. Interdum │
|
||||
┃ et │
|
||||
┃ malesuada fames ac ante ipsum primis in faucibus. Fusce porttitor iaculis │
|
||||
┃ sem, │
|
||||
┃ non dictum ipsum varius nec. Nulla eu erat at risus gravida blandit non vel │
|
||||
┃ ante. Nam egestas ipsum leo, eu ultricies ipsum tincidunt vel. Morbi a │
|
||||
┃ commodo │
|
||||
┃ eros. │
|
||||
┃ │
|
||||
┃ Nullam dictum, nisl ac varius tempus, ex tortor fermentum nisl, non │
|
||||
┃ tempus dolor neque a lorem. Suspendisse a faucibus ex, vel ornare tortor. │
|
||||
┃ Maecenas tincidunt id felis quis semper. Pellentesque enim libero, fermentum │
|
||||
┃ quis metus id, rhoncus euismod magna. Nulla finibus velit eu purus bibendum │
|
||||
┃ interdum. Integer id justo dui. Integer eu tellus in turpis bibendum │
|
||||
┃ blandit. │
|
||||
┃ Quisque auctor lacinia consectetur. │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
┎──────────────────────────────────────────────────────────────╮2020-09-24 09:14
|
||||
┃ The third entry finally after weeks without writing. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ I'm so excited about emojis. 💯 🎶 💩 │
|
||||
┃ │
|
||||
┃ Donec semper pellentesque iaculis. Nullam cursus et justo sit amet │
|
||||
┃ venenatis. │
|
||||
┃ Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. │
|
||||
┃ Nulla │
|
||||
┃ eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis │
|
||||
┃ dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh │
|
||||
┃ malesuada. │
|
||||
┃ Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis │
|
||||
┃ vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan │
|
||||
┃ justo. │
|
||||
┃ Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at │
|
||||
┃ ante eget fringilla. @tagthree and also @tagone │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
"""
|
||||
|
||||
Scenario: Export to yaml
|
||||
Given we use the config "tags.yaml"
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario Outline: Export to yaml
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
And we create cache directory "exported_journal"
|
||||
When we run "jrnl --export yaml -o {cache_dir}" with cache directory "exported_journal"
|
||||
Then cache directory "exported_journal" should contain the files
|
||||
"""
|
||||
[
|
||||
"2013-04-09_i-have-an-idea.md",
|
||||
"2013-06-10_i-met-with-dan.md"
|
||||
"2020-08-29_entry-the-first.md",
|
||||
"2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md",
|
||||
"2020-09-24_the-third-entry-finally-after-weeks-without-writing.md"
|
||||
]
|
||||
"""
|
||||
And the content of file "2013-04-09_i-have-an-idea.md" in cache directory "exported_journal" should be
|
||||
And the content of file "2020-08-29_entry-the-first.md" in cache directory "exported_journal" should be
|
||||
"""
|
||||
title: I have an @idea:
|
||||
date: 2013-04-09 15:39
|
||||
title: Entry the first.
|
||||
date: 2020-08-29 11:11
|
||||
starred: False
|
||||
tags: idea, journal
|
||||
tags: tagone, ipsum, tagtwo
|
||||
|
||||
(1) write a command line @journal software
|
||||
(2) ???
|
||||
(3) PROFIT!
|
||||
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. @tagone and maybe also @tagtwo.
|
||||
|
||||
Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
|
||||
ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. Suspendisse
|
||||
potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas eget
|
||||
molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed lectus
|
||||
hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
|
||||
feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, vestibulum
|
||||
urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod enim.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
|
||||
velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
|
||||
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||
conubia nostra, per inceptos himenaeos.
|
||||
"""
|
||||
|
||||
Scenario: Add a blank line to YAML export if there isn't one already
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
# | basic_dayone |
|
||||
|
||||
Scenario Outline: Add a blank line to YAML export if there isn't one already
|
||||
# https://github.com/jrnl-org/jrnl/issues/768
|
||||
# https://github.com/jrnl-org/jrnl/issues/881
|
||||
Given we use the config "deletion.yaml"
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
And we create cache directory "bug768"
|
||||
When we run "jrnl --export yaml -o {cache_dir}" with cache directory "bug768"
|
||||
Then cache directory "bug768" should contain the files
|
||||
"""
|
||||
[
|
||||
"2019-10-29_first-entry.md",
|
||||
"2019-10-29_second-entry.md",
|
||||
"2019-10-29_third-entry.md"
|
||||
"2020-08-29_entry-the-first.md",
|
||||
"2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md",
|
||||
"2020-09-24_the-third-entry-finally-after-weeks-without-writing.md"
|
||||
]
|
||||
"""
|
||||
And the content of file "2019-10-29_third-entry.md" in cache directory "bug768" should be
|
||||
And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in cache directory "bug768" should be
|
||||
"""
|
||||
title: Third entry.
|
||||
date: 2019-10-29 11:13
|
||||
title: The third entry finally after weeks without writing.
|
||||
date: 2020-09-24 09:14
|
||||
starred: False
|
||||
tags:
|
||||
tags: tagone, tagthree
|
||||
|
||||
I'm so excited about emojis. 💯 🎶 💩
|
||||
|
||||
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
|
||||
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. Nulla
|
||||
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
|
||||
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh malesuada.
|
||||
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
|
||||
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
|
||||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||
ante eget fringilla. @tagthree and also @tagone
|
||||
"""
|
||||
|
||||
Scenario: Printing a journal that has multiline entries
|
||||
Given we use the config "multiline.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
2013-06-09 15:39 Multiple line entry.
|
||||
| This is the first line.
|
||||
| This line doesn't have any ending punctuation
|
||||
|
|
||||
| There is a blank line above this.
|
||||
"""
|
||||
|
||||
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"
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
# | basic_dayone | @todo
|
||||
|
||||
Scenario: Empty DayOne entry bodies should not error
|
||||
# https://github.com/jrnl-org/jrnl/issues/780
|
||||
|
@ -252,13 +490,28 @@ Feature: Custom formats
|
|||
When we run "jrnl --short"
|
||||
Then we should get no error
|
||||
|
||||
Scenario: --short displays the short version of entries (only the title)
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl -on 2013-06-10 --short"
|
||||
Then the output should be "2013-06-10 15:40 Life is good."
|
||||
Scenario Outline: --short displays the short version of entries (only the title)
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -on 2020-08-31 --short"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
|
||||
Scenario: -s displays the short version of entries (only the title)
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl -on 2013-06-10 -s"
|
||||
Then the output should be "2013-06-10 15:40 Life is good."
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario Outline: -s displays the short version of entries (only the title)
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -on 2020-08-31 -s"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
|
|
@ -177,13 +177,20 @@ def open_editor_and_enter(context, method, text=""):
|
|||
|
||||
return tmpfile
|
||||
|
||||
if "password" in context:
|
||||
password = context.password
|
||||
else:
|
||||
password = ""
|
||||
|
||||
# fmt: off
|
||||
# see: https://github.com/psf/black/issues/664
|
||||
with \
|
||||
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
|
||||
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
|
||||
patch("sys.stdin.isatty", return_value=True) \
|
||||
:
|
||||
context.editor = mock_editor
|
||||
context.getpass = mock_getpass
|
||||
cli(["--edit"])
|
||||
# fmt: on
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue