From be1a01a6b22a812725ef564443797e86b19a2ab6 Mon Sep 17 00:00:00 2001 From: Thomas Zemp Date: Tue, 8 Aug 2023 13:40:17 +0200 Subject: [PATCH] fix: update jest mock [DHIS2-15415] --- src/shared/approval-status/get-approval-status.test.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/shared/approval-status/get-approval-status.test.js b/src/shared/approval-status/get-approval-status.test.js index 9997b0f..1d36075 100644 --- a/src/shared/approval-status/get-approval-status.test.js +++ b/src/shared/approval-status/get-approval-status.test.js @@ -8,9 +8,8 @@ import { Approved, Ready, Waiting } from './icons.js' jest.mock('moment', () => { const now = new Date() - const yearTwoYearsAgo = now.getFullYear() - 2 - return () => - jest.requireActual('moment')(`${yearTwoYearsAgo}-01-01T00:00:00.000Z`) + now.setFullYear(now.getFullYear() - 2) + return () => jest.requireActual('moment')(now) }) describe('getApprovalStatusDisplayData', () => {