From 3a266e67448baaed7beb7741c762ad791be8ad53 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 28 Jun 2022 11:14:47 +0200 Subject: [PATCH 1/2] chore: fixing the test Signed-off-by: blam --- .../HeaderWorldClock/HeaderWorldClock.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx b/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx index 3611f47787..97a35aad60 100644 --- a/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx +++ b/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx @@ -89,6 +89,8 @@ describe('HeaderWorldClock with invalid Time Zone', () => { describe('HeaderWorldClock with custom Time Format', () => { it('uses 24hr clock from custom Time Format', async () => { + jest.useFakeTimers().setSystemTime(new Date('2022-06-28T09:10:13.502Z')); + const clockConfigs: ClockConfig[] = [ { label: 'UTC', @@ -111,7 +113,7 @@ describe('HeaderWorldClock with custom Time Format', () => { , ); - const currentTime = `${new Date().getHours()}:${new Date().getMinutes()}`; + const currentTime = `09:10`; expect(rendered.getByText(currentTime)).toBeInTheDocument(); }); }); From 18bc7fb24e27a317ae41fecd0e873f8eaa1af27f Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 28 Jun 2022 11:17:49 +0200 Subject: [PATCH 2/2] chore: remove the needless var i Signed-off-by: blam --- .../HeaderWorldClock/HeaderWorldClock.test.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx b/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx index 97a35aad60..db92fbb89f 100644 --- a/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx +++ b/plugins/home/src/homePageComponents/HeaderWorldClock/HeaderWorldClock.test.tsx @@ -113,7 +113,6 @@ describe('HeaderWorldClock with custom Time Format', () => { , ); - const currentTime = `09:10`; - expect(rendered.getByText(currentTime)).toBeInTheDocument(); + expect(rendered.getByText('09:10')).toBeInTheDocument(); }); });