@@ -275,29 +275,31 @@ describe('ChartWidgetLoader - unmocked imports', () => {
275
275
// - `id` must match the filename
276
276
// - have a `default` export that is a React component (component name should be TitleCase of `id`)
277
277
// - be mapped via `id` -> dynamic import in `chartWidgetLoader.tsx`
278
- it . each ( widgetIds as ChartId [ ] ) ( 'can load widget: %s' , async widgetId => {
279
- render ( < ChartWidgetLoader id = { widgetId } /> ) ;
278
+ it . each ( widgetIds as ChartId [ ] ) (
279
+ 'can load widget: %s' ,
280
+ async widgetId => {
281
+ render ( < ChartWidgetLoader id = { widgetId } /> ) ;
280
282
281
- // Initially should show loading state from ChartWidgetLoader, it will disappear when dynamic import completes.
282
- // We only need to check that the dynamic import completes for these tests as that means ChartWidgetLoader is able to load all widgets
283
- expect ( screen . getByTestId ( 'loading-placeholder' ) ) . toBeInTheDocument ( ) ;
283
+ // Initially should show loading state from ChartWidgetLoader, it will disappear when dynamic import completes.
284
+ // We only need to check that the dynamic import completes for these tests as that means ChartWidgetLoader is able to load all widgets
285
+ await waitFor (
286
+ ( ) => {
287
+ expect ( screen . queryByTestId ( 'loading-placeholder' ) ) . not . toBeInTheDocument ( ) ;
288
+ } ,
289
+ {
290
+ timeout : 10_000 ,
291
+ }
292
+ ) ;
284
293
285
- await waitFor (
286
- ( ) => {
287
- expect ( screen . queryByTestId ( 'loading-placeholder' ) ) . not . toBeInTheDocument ( ) ;
288
- } ,
289
- {
290
- timeout : 2000 ,
291
- }
292
- ) ;
293
-
294
- expect ( TimeSeriesWidgetVisualization ) . toHaveBeenCalledWith (
295
- expect . objectContaining ( {
296
- id : widgetId ,
297
- } ) ,
298
- undefined
299
- ) ;
300
- } ) ;
294
+ expect ( TimeSeriesWidgetVisualization ) . toHaveBeenCalledWith (
295
+ expect . objectContaining ( {
296
+ id : widgetId ,
297
+ } ) ,
298
+ undefined
299
+ ) ;
300
+ } ,
301
+ 15_000
302
+ ) ;
301
303
302
304
it ( 'shows error state for invalid widget id' , async ( ) => {
303
305
const consoleSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
0 commit comments