mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Implement testing for -month, -day, -year, and -reminisce
This commit is contained in:
parent
d15d7daa97
commit
0355af936c
4 changed files with 117 additions and 0 deletions
12
features/data/configs/dates_similar.yaml
Normal file
12
features/data/configs/dates_similar.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
default_hour: 9
|
||||||
|
default_minute: 0
|
||||||
|
editor: ''
|
||||||
|
encrypt: false
|
||||||
|
template: false
|
||||||
|
highlight: true
|
||||||
|
journals:
|
||||||
|
default: features/journals/dates_similar.journal
|
||||||
|
linewrap: 80
|
||||||
|
tagsymbols: '@'
|
||||||
|
timeformat: '%Y-%m-%d %H:%M'
|
||||||
|
indent_character: "|"
|
9
features/data/journals/dates_similar.journal
Normal file
9
features/data/journals/dates_similar.journal
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[2018-02-04 06:04] Today is 2018-02-04.
|
||||||
|
|
||||||
|
[2018-03-05 08:06] Today is 2018-03-05.
|
||||||
|
|
||||||
|
[2019-01-03 10:08] Today is 2019-01-03.
|
||||||
|
|
||||||
|
[2020-02-05 12:10] Today is 2020-02-05.
|
||||||
|
|
||||||
|
[2021-01-03 15:39] Today is 2021-01-03.
|
|
@ -214,6 +214,83 @@ Feature: Searching in a journal
|
||||||
| But I'm better.
|
| But I'm better.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by numerical month
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -month 2"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2018-02-04 06:04 Today is 2018-02-04.
|
||||||
|
|
||||||
|
2020-02-05 12:10 Today is 2020-02-05.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by full month string
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -month February"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2018-02-04 06:04 Today is 2018-02-04.
|
||||||
|
|
||||||
|
2020-02-05 12:10 Today is 2020-02-05.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by "Mmm" month
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -month Feb"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2018-02-04 06:04 Today is 2018-02-04.
|
||||||
|
|
||||||
|
2020-02-05 12:10 Today is 2020-02-05.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by day
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -day 5"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2018-03-05 08:06 Today is 2018-03-05.
|
||||||
|
|
||||||
|
2020-02-05 12:10 Today is 2020-02-05.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by full year
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -year 2018"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2018-02-04 06:04 Today is 2018-02-04.
|
||||||
|
|
||||||
|
2018-03-05 08:06 Today is 2018-03-05.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by "yy" year
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -year 18"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2018-02-04 06:04 Today is 2018-02-04.
|
||||||
|
|
||||||
|
2018-03-05 08:06 Today is 2018-03-05.
|
||||||
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching entries by day and month
|
||||||
|
Given we use the config "dates_similar.yaml"
|
||||||
|
When we run "jrnl -month 1 -day 3"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should be
|
||||||
|
"""
|
||||||
|
2019-01-03 10:08 Today is 2019-01-03.
|
||||||
|
|
||||||
|
2021-01-03 15:39 Today is 2021-01-03.
|
||||||
|
"""
|
||||||
|
|
||||||
Scenario: Loading a DayOne Journal
|
Scenario: Loading a DayOne Journal
|
||||||
Given we use the config "dayone.yaml"
|
Given we use the config "dayone.yaml"
|
||||||
When we run "jrnl -from 'feb 2013'"
|
When we run "jrnl -from 'feb 2013'"
|
||||||
|
|
|
@ -151,6 +151,25 @@ def test_on_date_alone():
|
||||||
assert cli_as_dict("-on 'saturday'") == expected_args(on_date="saturday")
|
assert cli_as_dict("-on 'saturday'") == expected_args(on_date="saturday")
|
||||||
|
|
||||||
|
|
||||||
|
def test_month_alone():
|
||||||
|
assert cli_as_dict("-month 1") == expected_args(month="1")
|
||||||
|
assert cli_as_dict("-month January") == expected_args(month="January")
|
||||||
|
assert cli_as_dict("-month Jan") == expected_args(month="Jan")
|
||||||
|
|
||||||
|
|
||||||
|
def test_day_alone():
|
||||||
|
assert cli_as_dict("-day 1") == expected_args(day="1")
|
||||||
|
|
||||||
|
|
||||||
|
def test_year_alone():
|
||||||
|
assert cli_as_dict("-year 2021") == expected_args(year="2021")
|
||||||
|
assert cli_as_dict("-year 21") == expected_args(year="21")
|
||||||
|
|
||||||
|
|
||||||
|
def test_reminisce_alone():
|
||||||
|
assert cli_as_dict("-reminisce") == expected_args(reminisce=True)
|
||||||
|
|
||||||
|
|
||||||
def test_short_alone():
|
def test_short_alone():
|
||||||
assert cli_as_dict("--short") == expected_args(short=True)
|
assert cli_as_dict("--short") == expected_args(short=True)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue