From 852aef1dc6bc1d14fff81fe7a16f0662fa9c1734 Mon Sep 17 00:00:00 2001 From: Phred Date: Thu, 6 Aug 2026 19:50:12 -0500 Subject: [PATCH 1/2] fixed broken test (timezones :shrug:) Signed-off-by: Phred --- cron/mergeRenovatePRs.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cron/mergeRenovatePRs.test.ts b/cron/mergeRenovatePRs.test.ts index a515d14..b97068d 100644 --- a/cron/mergeRenovatePRs.test.ts +++ b/cron/mergeRenovatePRs.test.ts @@ -96,7 +96,19 @@ describe('mergeRenovatePRs', () => { }); it('should not merge on Tuesdays', async () => { - jest.useFakeTimers({ now: new Date('2022-06-28T00:00:00.000Z') }); + // NOTE: This test would previously pass/fail based on the phystical + // location where it was run. + // Example: Midnight UTC is 7pm CDT on the previous day + // + // To fix this, we adjust the generated date by the timezone offset + const desiredDate = new Date('2022-06-28T00:00:00.000Z'); + const ONE_EARTH_MINUTE = 60_000; + jest.useFakeTimers({ + now: new Date( + desiredDate.getTime() + + desiredDate.getTimezoneOffset() * ONE_EARTH_MINUTE, + ), + }); await mergeRenovatePRs(client, repoInfo, log, 0); expect(mockClient.rest.pulls.merge).not.toHaveBeenCalled(); From 7dacff8d6da1f3ce756d34160d2626bb42e6285f Mon Sep 17 00:00:00 2001 From: Phred Date: Tue, 11 Aug 2026 13:52:25 -0500 Subject: [PATCH 2/2] fixed code logic instead of the test :facepalm: Signed-off-by: Phred --- cron/mergeRenovatePRs.test.ts | 14 +------------- cron/mergeRenovatePRs.ts | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/cron/mergeRenovatePRs.test.ts b/cron/mergeRenovatePRs.test.ts index b97068d..a515d14 100644 --- a/cron/mergeRenovatePRs.test.ts +++ b/cron/mergeRenovatePRs.test.ts @@ -96,19 +96,7 @@ describe('mergeRenovatePRs', () => { }); it('should not merge on Tuesdays', async () => { - // NOTE: This test would previously pass/fail based on the phystical - // location where it was run. - // Example: Midnight UTC is 7pm CDT on the previous day - // - // To fix this, we adjust the generated date by the timezone offset - const desiredDate = new Date('2022-06-28T00:00:00.000Z'); - const ONE_EARTH_MINUTE = 60_000; - jest.useFakeTimers({ - now: new Date( - desiredDate.getTime() + - desiredDate.getTimezoneOffset() * ONE_EARTH_MINUTE, - ), - }); + jest.useFakeTimers({ now: new Date('2022-06-28T00:00:00.000Z') }); await mergeRenovatePRs(client, repoInfo, log, 0); expect(mockClient.rest.pulls.merge).not.toHaveBeenCalled(); diff --git a/cron/mergeRenovatePRs.ts b/cron/mergeRenovatePRs.ts index e2cb329..b63d697 100644 --- a/cron/mergeRenovatePRs.ts +++ b/cron/mergeRenovatePRs.ts @@ -11,7 +11,7 @@ export async function mergeRenovatePRs( const { owner, repo } = repoInfo; const date = new Date(); - if (date.getDay() === 2) { + if (date.getUTCDay() === 2) { log('Skipping auto merge because Tuesday is release day'); return; }