From 0da82c7dd3aa55797f90e5db664878c48013dab9 Mon Sep 17 00:00:00 2001 From: josephkmh Date: Wed, 7 Dec 2022 16:33:54 +0100 Subject: [PATCH 1/2] fix test assertion and mock TZ --- .../src/components/ui/DatePicker/DatePicker.test.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx b/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx index bf5900c440b5..e4c248ff5b21 100644 --- a/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx +++ b/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx @@ -26,12 +26,15 @@ describe(`${toEquivalentLocalTime.name}`, () => { }); it("outputs the same YYYY-MM-DDTHH:mm:ss", () => { + timezoneMock.register("Etc/GMT+10"); + const TEST_TIMEZONE_UTC_OFFSET_IN_MINUTES = 600; // correspond to GMT+10 const TEST_UTC_TIMESTAMP = "2000-01-01T12:00:00Z"; const result = toEquivalentLocalTime(TEST_UTC_TIMESTAMP); // Regardless of the timezone, the local time should be the same - expect(result?.toISOString().substring(0, 19)).toEqual(TEST_UTC_TIMESTAMP.substring(0, 19)); + expect(dayjs(result).format().substring(0, 19)).toEqual(TEST_UTC_TIMESTAMP.substring(0, 19)); + expect(result?.getTimezoneOffset()).toEqual(TEST_TIMEZONE_UTC_OFFSET_IN_MINUTES); }); it("converts utc time to equivalent local time in PST", () => { From bbeff70f11c4fa8a1db29f13f8a8526e6e7b22d5 Mon Sep 17 00:00:00 2001 From: josephkmh Date: Wed, 7 Dec 2022 16:39:05 +0100 Subject: [PATCH 2/2] fix typo --- airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx b/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx index e4c248ff5b21..5b6ca56dac31 100644 --- a/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx +++ b/airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx @@ -27,7 +27,7 @@ describe(`${toEquivalentLocalTime.name}`, () => { it("outputs the same YYYY-MM-DDTHH:mm:ss", () => { timezoneMock.register("Etc/GMT+10"); - const TEST_TIMEZONE_UTC_OFFSET_IN_MINUTES = 600; // correspond to GMT+10 + const TEST_TIMEZONE_UTC_OFFSET_IN_MINUTES = 600; // corresponds to GMT+10 const TEST_UTC_TIMESTAMP = "2000-01-01T12:00:00Z"; const result = toEquivalentLocalTime(TEST_UTC_TIMESTAMP);