From 0b638f1ffa4e9d7ab0dd04a78307e38b08e82a70 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Mon, 11 Oct 2021 11:09:26 -0600 Subject: [PATCH] Move (selected) tests to Pytest # Conflicts: # features/format.feature # jrnl/plugins/yaml_exporter.py # tests/bdd/features/format.feature --- tests/bdd/features/format.feature | 641 ++++++++++++++++++++++++++++++ 1 file changed, 641 insertions(+) create mode 100644 tests/bdd/features/format.feature diff --git a/tests/bdd/features/format.feature b/tests/bdd/features/format.feature new file mode 100644 index 00000000..7fdb95ab --- /dev/null +++ b/tests/bdd/features/format.feature @@ -0,0 +1,641 @@ +Feature: Custom formats + + Scenario Outline: JSON format + Given we use the config "" + 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 valid JSON + Given we parse the output as JSON + Then "entries" in the parsed output should have 3 elements + And "tags" in the parsed output should be + @ipsum + @tagone + @tagtwo + @tagthree + 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 | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + 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 + 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 "" + 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 + 2020-08-29 11:11 Entry the first. + | 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. + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + Scenario Outline: Exporting using filters should only export parts of the journal + Given we use the config "" + And we use the password "test" if prompted + When we run "jrnl -until 'August 2020' --format json" + Then the output should be valid JSON + Then we should get no error + And the output should be valid JSON + Given we parse the output as JSON + Then "entries" in the parsed output should have 2 elements + And "tags" in the parsed output should be + @ipsum + @tagone + @tagtwo + And "entries.0.tags" in the parsed output should have 3 elements + And "entries.1.tags" in the parsed output should have 1 elements + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + Scenario Outline: Exporting using custom templates + Given we use the config "" + And we use the password "test" if prompted + When we run "jrnl -1 --format sample" + Then the output should be + 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 + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + @skip_editor # .TODO return after editor steps implemented + Scenario Outline: Increasing Headings on Markdown export + Given we use the config "" + 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 + When we run "jrnl -1 --export markdown" + Then the output should be + # 2020 + + ## October + + ### 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 + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | @todo + + @skip_editor # .TODO return after editor steps implemented + 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 "" + 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. + When we run "jrnl -3 --format markdown" + Then the output should be + # 2020 + + ## October + + ### 2020-10-29 11:11 First entry. + + + ### 2020-10-29 11:11 Second entry. + + + ### 2020-10-29 11:13 Third entry. + + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | @todo + + @skip + Scenario Outline: Exporting to XML + Given we use the config "" + 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" 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_file | + # | basic_onefile.yaml | @todo + # | basic_encrypted.yaml | @todo + # | basic_folder.yaml | @todo + # | basic_dayone.yaml | @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 valid XML + Given we parse the output as XML + Then "entries" in the parsed output should have 2 elements + And "tags" in the parsed output should be + @idea + @journal + @dan + And there should be 7 "tag" elements + + Scenario Outline: Exporting tags + Given we use the config "" + And we use the password "test" if prompted + When we run "jrnl --export tags" + Then the output should be + @tagtwo : 2 + @tagone : 2 + @tagthree : 1 + @ipsum : 1 + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + @todo + Scenario Outline: Exporting fancy + # Needs better emoji support + Given we use the config "" + And we use the password "test" if prompted + When we run "jrnl --export fancy" + Then the output should be + โ”Žโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ2020-08-29 11:11 + โ”ƒ Entry the first. โ•˜โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•• + โ” โ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ”ค + โ”ƒ 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. โ”‚ + โ”–โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”Žโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ2020-08-31 14:32 + โ”ƒ A second entry in what I hope to be a long series. โ•˜โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•• + โ” โ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ•Œโ”ค + โ”ƒ 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 โ”‚ + โ”–โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + @skip_win # Travis has formatting issues here, but not locally + Scenario Outline: Export to yaml + Given we use the config "" + And we use the password "test" if prompted + And we create a cache directory + When we run "jrnl --format yaml --file {cache_dir}" + Then the cache directory should contain the files + 2020-08-29_entry-the-first.yaml + 2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.yaml + 2020-09-24_the-third-entry-finally-after-weeks-without-writing.yaml + + And the content of file "2020-08-29_entry-the-first.yaml" in the cache should be + --- + title: Entry the first. + date: 2020-08-29 11:11 + starred: False + tags: tagone, ipsum, tagtwo + body: | + + 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. + ... + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | + + @skip_win # @todo YAML exporter does not correctly export emoji on Windows + 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 "" + And we use the password "test" if prompted + And we create a cache directory + When we run "jrnl --export yaml -o {cache_dir}" + Then the cache should contain the files + 2020-08-29_entry-the-first.yaml + 2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.yaml + 2020-09-24_the-third-entry-finally-after-weeks-without-writing.yaml + And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.yaml" in the cache should be + --- + title: The third entry finally after weeks without writing. + date: 2020-09-24 09:14 + starred: False + tags: tagone, tagthree + body: | + + 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 + ... + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | @todo + + Scenario Outline: Export to Pelican Markdown + Given we use the config "" + And we use the password "test" if prompted + And we create a cache directory + When we run "jrnl --format pelican-markdown --file {cache_dir}" + Then the cache directory should contain the files + 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 "2020-08-29_entry-the-first.md" in the cache should be + title: Entry the first. + date: 2020-08-29 11:11 + starred: False + tags: tagone, ipsum, tagtwo + + 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. + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | + + @skip_win # @todo YAML exporter does not correctly export emoji on Windows + Scenario Outline: Add a blank line to Pelican 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 "" + And we use the password "test" if prompted + And we create a cache directory + When we run "jrnl --export pelican-markdown -o {cache_dir}" + Then the cache should contain the files + 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 "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in the cache should be + title: The third entry finally after weeks without writing. + date: 2020-09-24 09:14 + starred: False + 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 + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | @todo + + Scenario: Empty DayOne entry bodies should not error + # https://github.com/jrnl-org/jrnl/issues/780 + Given we use the config "bug780.yaml" + When we run "jrnl --short" + Then we should get no error + + Scenario Outline: --short displays the short version of entries (only the title) + Given we use the config "" + 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." + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + Scenario Outline: -s displays the short version of entries (only the title) + Given we use the config "" + 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_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + Scenario: Markdown Support from config file + Given we use the config "format_md.yaml" + When we run "jrnl -n 1" + Then the output should be + # 2013 + + ## June + + ### 2013-06-10 15:40 Life is good. + + But I'm better. + + Scenario: Text Formatter from config file + Given we use the config "format_text.yaml" + When we run "jrnl -n 1" + Then the output should be + [2013-06-10 15:40] Life is good. + But I'm better. + + Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail + Given we use the config "" + And we use the password "test" if prompted + And we create a cache directory + When we run "jrnl 2020-11-21: ะŸะตั€ะฒะฐั" + When we run "jrnl --format md --file {cache_dir} -on 2020-11-21" + Then the cache should contain the files + 2020-11-21_ะฟะตั€ะฒะฐั.md + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml | + + Scenario Outline: Export date counts + Given we use the config "" + And we use the password "test" if prompted + When we run "jrnl 2020-08-31 01:01: Hi." + And we run "jrnl --format dates" + Then the output should be + 2020-08-29, 1 + 2020-08-31, 2 + 2020-09-24, 1 + + Examples: configs + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + | basic_dayone.yaml |