Skip to content

Commit 078ad42

Browse files
author
Joey Marshment-Howell
authored
🪟 🐛 Fix test assertion in datepicker tests (#20188)
* fix test assertion and mock TZ * fix typo
1 parent ca67ee7 commit 078ad42

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

airbyte-webapp/src/components/ui/DatePicker/DatePicker.test.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ describe(`${toEquivalentLocalTime.name}`, () => {
2626
});
2727

2828
it("outputs the same YYYY-MM-DDTHH:mm:ss", () => {
29+
timezoneMock.register("Etc/GMT+10");
30+
const TEST_TIMEZONE_UTC_OFFSET_IN_MINUTES = 600; // corresponds to GMT+10
2931
const TEST_UTC_TIMESTAMP = "2000-01-01T12:00:00Z";
3032

3133
const result = toEquivalentLocalTime(TEST_UTC_TIMESTAMP);
3234

3335
// Regardless of the timezone, the local time should be the same
34-
expect(result?.toISOString().substring(0, 19)).toEqual(TEST_UTC_TIMESTAMP.substring(0, 19));
36+
expect(dayjs(result).format().substring(0, 19)).toEqual(TEST_UTC_TIMESTAMP.substring(0, 19));
37+
expect(result?.getTimezoneOffset()).toEqual(TEST_TIMEZONE_UTC_OFFSET_IN_MINUTES);
3538
});
3639

3740
it("converts utc time to equivalent local time in PST", () => {

0 commit comments

Comments
 (0)