From 54a9df4619e033fe9d590c6a69fe755200dff3f3 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Wed, 7 Jan 2015 16:52:04 +0100 Subject: [PATCH] test(cron): setup failing test for changing cds to an hour past last cron --- test/algos.mocha.coffee | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/algos.mocha.coffee b/test/algos.mocha.coffee index bf706e0266..d830e13163 100644 --- a/test/algos.mocha.coffee +++ b/test/algos.mocha.coffee @@ -572,8 +572,17 @@ describe 'Cron', -> # should be 1 day later than lastCron lastCron = moment('2014-10-09 12:30:00') days = shared.daysSince(lastCron, {now: moment('2014-10-10 10:30:00'), dayStart}) - expect(days).to.eql 1 + expect(days).to.eql 1 + it 'daysSince, last cron before new dayStart', -> + # If lastCron was after dayStart (at 1am) with dayStart set at 0, changing dayStart to 4am + # should not trigger another cron the same day + + # dayStart is 0 + lastCron = moment('2014-10-09 01:00:00') + # dayStart is 4 + days = shared.daysSince(lastCron, {now: moment('2014-10-09 05:00:00'), dayStart}) + expect(days).to.eql 0 describe 'dailies', ->