From 078ad42f38ff7f607d8d06f5af43f334a71d107a Mon Sep 17 00:00:00 2001 From: Joey Marshment-Howell Date: Wed, 7 Dec 2022 19:58:21 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9F=20=F0=9F=90=9B=20Fix=20test=20asse?= =?UTF-8?q?rtion=20in=20datepicker=20tests=20(#20188)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix test assertion and mock TZ * fix typo --- .../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..5b6ca56dac31 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; // corresponds 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", () => {