@@ -130,7 +130,9 @@ defmodule Crontab.FunctionalTest do
130
130
{ "* * * * 5#1" , "* * * * 5#1 *" , ~N[ 2011-07-01 00:00:00] , ~N[ 2011-07-01 00:00:00] ,
131
131
~N[ 2011-07-01 00:00:00] , true } ,
132
132
{ "* * * * 3#4" , "* * * * 3#4 *" , ~N[ 2011-07-01 00:00:00] , ~N[ 2011-07-27 00:00:00] ,
133
- ~N[ 2011-06-22 23:59:00] , false }
133
+ ~N[ 2011-06-22 23:59:00] , false } ,
134
+ { "0 9 * * mon#5" , "0 9 * * 1#5 *" , ~N[ 2024-10-22 09:00:00] , ~N[ 2024-12-30 09:00:00] ,
135
+ ~N[ 2024-09-30 09:00:00] , false }
134
136
]
135
137
136
138
for { cron_expression , written_cron_expression , start_date , next_search_date ,
@@ -149,17 +151,25 @@ defmodule Crontab.FunctionalTest do
149
151
{ :ok , cron_expression } = Parser . parse ( @ cron_expression )
150
152
assert Composer . compose ( cron_expression ) == @ written_cron_expression
151
153
152
- assert Crontab.Scheduler . get_next_run_date ( cron_expression , @ start_date ) ==
153
- { :ok , @ next_search_date }
154
+ assert { :ok , next_search_date } =
155
+ Crontab.Scheduler . get_next_run_date ( cron_expression , @ start_date )
156
+
157
+ assert Crontab.DateChecker . matches_date? ( cron_expression , next_search_date )
158
+
159
+ assert next_search_date == @ next_search_date
154
160
155
161
case @ previous_search_date do
156
162
:none ->
157
163
assert Crontab.Scheduler . get_previous_run_date ( cron_expression , @ start_date ) ==
158
164
{ :error , "No compliant date was found for your interval." }
159
165
160
166
_ ->
161
- assert Crontab.Scheduler . get_previous_run_date ( cron_expression , @ start_date ) ==
162
- { :ok , @ previous_search_date }
167
+ assert { :ok , previous_search_date } =
168
+ Crontab.Scheduler . get_previous_run_date ( cron_expression , @ start_date )
169
+
170
+ assert Crontab.DateChecker . matches_date? ( cron_expression , previous_search_date )
171
+
172
+ assert previous_search_date == @ previous_search_date
163
173
end
164
174
165
175
assert Crontab.DateChecker . matches_date? ( cron_expression , @ start_date ) == @ matches_now
0 commit comments