This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch airbnb
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 938b1fd3c191fea50307d4c53ef3a0a19593372d
Author: Geido <[email protected]>
AuthorDate: Mon Nov 4 16:08:44 2024 +0200

    fix(TimezoneSelector): Failing unit tests due to timezone change (#30828)
    
    (cherry picked from commit 5820d31b5c15d706fc26e6d6fb33b4ff1b16f4c3)
---
 .../TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx | 5 ++++-
 .../src/components/TimezoneSelector/TimezoneSelector.test.tsx     | 8 +++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx
 
b/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx
index 81dbc6fdcd..395d48ad99 100644
--- 
a/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx
+++ 
b/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx
@@ -30,10 +30,13 @@ const loadComponent = (mockCurrentTime?: string) => {
   return new Promise<FC<TimezoneSelectorProps>>(resolve => {
     const { default: TimezoneSelector } = module.require('./index');
     resolve(TimezoneSelector);
-    jest.useRealTimers();
   });
 };
 
+afterEach(() => {
+  jest.useRealTimers();
+});
+
 test('render timezones in correct order for daylight saving time', async () => 
{
   const TimezoneSelector = await loadComponent('2022-07-01');
   const onTimezoneChange = jest.fn();
diff --git 
a/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.test.tsx 
b/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.test.tsx
index 173118c7e8..7866cd2261 100644
--- 
a/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.test.tsx
+++ 
b/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.test.tsx
@@ -30,7 +30,6 @@ const loadComponent = (mockCurrentTime?: string) => {
   return new Promise<FC<TimezoneSelectorProps>>(resolve => {
     const { default: TimezoneSelector } = module.require('./index');
     resolve(TimezoneSelector);
-    jest.useRealTimers();
   });
 };
 
@@ -44,6 +43,10 @@ const openSelectMenu = () => {
 
 jest.spyOn(moment.tz, 'guess').mockReturnValue('America/New_York');
 
+afterEach(() => {
+  jest.useRealTimers();
+});
+
 test('use the timezone from `moment` if no timezone provided', async () => {
   const TimezoneSelector = await loadComponent('2022-01-01');
   const onTimezoneChange = jest.fn();
@@ -89,7 +92,6 @@ test('render timezones in correct oder for standard time', 
async () => {
   expect(options[0]).toHaveTextContent('GMT -05:00 (Eastern Standard Time)');
   expect(options[1]).toHaveTextContent('GMT -11:00 (Pacific/Pago_Pago)');
   expect(options[2]).toHaveTextContent('GMT -10:00 (Hawaii Standard Time)');
-  expect(options[3]).toHaveTextContent('GMT -10:00 (America/Adak)');
 });
 
 test('can select a timezone values and returns canonical timezone name', async 
() => {
@@ -106,7 +108,7 @@ test('can select a timezone values and returns canonical 
timezone name', async (
 
   const searchInput = screen.getByRole('combobox');
   // search for mountain time
-  await userEvent.type(searchInput, 'mou', { delay: 10 });
+  await userEvent.type(searchInput, 'mou');
   const findTitle = 'GMT -07:00 (Mountain Standard Time)';
   const selectOption = await screen.findByTitle(findTitle);
   userEvent.click(selectOption);

Reply via email to