From b006ef077058547e140311040fd1985e214f54e0 Mon Sep 17 00:00:00 2001 From: schmanu Date: Mon, 27 Mar 2023 10:43:43 +0200 Subject: [PATCH] fix: DateTime jest test --- src/components/common/DateTime/index.test.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/common/DateTime/index.test.tsx b/src/components/common/DateTime/index.test.tsx index cc67df7d92..a749c21d71 100644 --- a/src/components/common/DateTime/index.test.tsx +++ b/src/components/common/DateTime/index.test.tsx @@ -9,6 +9,16 @@ jest.mock('@/utils/tx-history-filter', () => ({ })) describe('DateTime', () => { + beforeAll(() => { + // If we do not use a fixed date, this test will fail once a year (in some timezones) due to daylight saving time. + jest.useFakeTimers() + jest.setSystemTime(Date.parse('01.01.2023')) + }) + + afterAll(() => { + jest.useRealTimers() + }) + it('should render the relative time before threshold on the queue', () => { const date = new Date() const days = 3