From db2e15b1f5d2273fbb4cbdf8fa431cfe8e31422e Mon Sep 17 00:00:00 2001 From: Sebastian Markgraf Date: Mon, 19 Feb 2024 14:47:28 +0100 Subject: [PATCH 1/2] fix(test): fix testcase should not depend on today --- src/__tests__/api.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/__tests__/api.test.tsx b/src/__tests__/api.test.tsx index 18a940c..8e52357 100644 --- a/src/__tests__/api.test.tsx +++ b/src/__tests__/api.test.tsx @@ -10,11 +10,13 @@ import 'dayjs/locale/tr'; describe('API TESTS', () => { test('should display the passed date', () => { - const selectedDate = new Date(); + const selectedDate = new Date(2020, 12, 19); const month = selectedDate.toLocaleString('en-US', { month: 'long' }); render(); expect(screen.getByText(month)).toBeVisible(); + expect(screen.getByText('19')).toBeVisible(); + expect(screen.getByText('2020')).toBeVisible(); }); // test('minDate should be applied after init', () => { From 59a0283cf8dfc1a2995fddc52be44026d37aae97 Mon Sep 17 00:00:00 2001 From: Sebastian Markgraf Date: Mon, 19 Feb 2024 14:55:14 +0100 Subject: [PATCH 2/2] fix(test): fix test month --- src/__tests__/api.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__tests__/api.test.tsx b/src/__tests__/api.test.tsx index 8e52357..9947a7f 100644 --- a/src/__tests__/api.test.tsx +++ b/src/__tests__/api.test.tsx @@ -10,7 +10,7 @@ import 'dayjs/locale/tr'; describe('API TESTS', () => { test('should display the passed date', () => { - const selectedDate = new Date(2020, 12, 19); + const selectedDate = new Date(2020, 11, 19); const month = selectedDate.toLocaleString('en-US', { month: 'long' }); render();