geido commented on code in PR #36486:
URL: https://github.com/apache/superset/pull/36486#discussion_r2610648120


##########
superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx:
##########
@@ -37,25 +37,55 @@ afterEach(() => {
 });
 
 test('render timezones in correct order for daylight saving time', async () => 
{
+  // Set system time BEFORE loading component to ensure cache uses correct date
+  jest.useFakeTimers();
+  jest.setSystemTime(new Date('2022-07-01'));
+
   const TimezoneSelector = await loadComponent('2022-07-01');
   const onTimezoneChange = jest.fn();
-  render(
+  const { container } = render(
     <TimezoneSelector
       onTimezoneChange={onTimezoneChange}
       timezone="America/Nassau"
     />,
   );
 
+  // Trigger data loading by clicking the select
   const searchInput = screen.getByRole('combobox');
   await userEvent.click(searchInput);
 
+  // Run timers to execute queueMicrotask/setTimeout callback
+  jest.runAllTimers();
+
+  // Wait for timezone data to load
+  await waitFor(() => {
+    expect(screen.queryByText('Loading...')).not.toBeInTheDocument();

Review Comment:
   Nit: can we use `findByText` instead of `waitFor`? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to