From 27b7f4c13457177b044fccceeb5d8174fed6f0e7 Mon Sep 17 00:00:00 2001 From: Harshit Raj <35199148+rharshit82@users.noreply.github.com> Date: Sun, 24 Sep 2023 03:02:45 +0530 Subject: [PATCH] fixed test case for string utc --- tests/cron.test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/cron.test.js b/tests/cron.test.js index e65e8f68..8037dcb5 100644 --- a/tests/cron.test.js +++ b/tests/cron.test.js @@ -891,7 +891,9 @@ describe('cron', () => { // Current time const t = luxon.DateTime.local(); // UTC Offset decreased by an hour (string format '(+/-)HH:mm') - const utcOffset = t.offset - 60; + // We support only HH support in offset as we support string offset in Timezone. + const minutesOffset = t.offset - Math.floor((t.offset - 60) / 60) * 60; + const utcOffset = t.offset - minutesOffset; const utcOffsetString = `${utcOffset > 0 ? '+' : '-'}${( '0' + Math.floor(Math.abs(utcOffset) / 60) ).slice(-2)}:${('0' + (utcOffset % 60)).slice(-2)}`; @@ -907,8 +909,8 @@ describe('cron', () => { utcOffsetString ); - // tick 1 sec before an hour - clock.tick(1000 * 60 * 60 - 1); + // tick 1 sec before minutesOffset + clock.tick(1000 * 60 * minutesOffset - 1); expect(callback).toHaveBeenCalledTimes(0); // tick 1 sec