michael-s-molina commented on a change in pull request #14371:
URL: https://github.com/apache/superset/pull/14371#discussion_r621197540



##########
File path: 
superset-frontend/src/dashboard/components/gridComponents/ChartHolder.test.tsx
##########
@@ -65,27 +62,25 @@ describe('ChartHolder', () => {
     dashboardId: 123,
   };
 
-  const renderWrapper = (props = defaultProps, state?: object) =>
-    render(
-      <Provider store={state ? getMockStore(state) : mockStore}>
-        <DndProvider backend={HTML5Backend}>
-          <ChartHolder {...props} />
-        </DndProvider>
-      </Provider>,
-    );
+  const renderWrapper = (props = defaultProps, state = mockState) =>
+    render(<ChartHolder {...props} />, {
+      useRedux: true,
+      initialState: state,
+      useDnd: true,
+    });
 
   it('toggle full size', async () => {
     renderWrapper();
     // @ts-ignore
-    let chart = screen.getByTestId('slice-container')?.firstChild?.style;
+    let chart = screen.getByTestId('slice-container').firstChild.style!;
     expect(chart?.width).toBe('900px');
     expect(chart?.height).toBe('26px');
 
     userEvent.click(screen.getByRole('button'));
     userEvent.click(screen.getByText('Maximize chart'));
 
     // @ts-ignore
-    chart = screen.getByTestId('slice-container')?.firstChild?.style;
+    chart = screen.getByTestId('slice-container').firstChild.style!;
     await waitFor(() => expect(chart?.width).toBe('992px'));
     expect(chart?.height).toBe('714px');

Review comment:
       ```suggestion
       expect(chart.height).toBe('714px');
   ```

##########
File path: 
superset-frontend/src/dashboard/components/gridComponents/ChartHolder.test.tsx
##########
@@ -65,27 +62,25 @@ describe('ChartHolder', () => {
     dashboardId: 123,
   };
 
-  const renderWrapper = (props = defaultProps, state?: object) =>
-    render(
-      <Provider store={state ? getMockStore(state) : mockStore}>
-        <DndProvider backend={HTML5Backend}>
-          <ChartHolder {...props} />
-        </DndProvider>
-      </Provider>,
-    );
+  const renderWrapper = (props = defaultProps, state = mockState) =>
+    render(<ChartHolder {...props} />, {
+      useRedux: true,
+      initialState: state,
+      useDnd: true,
+    });
 
   it('toggle full size', async () => {
     renderWrapper();
     // @ts-ignore
-    let chart = screen.getByTestId('slice-container')?.firstChild?.style;
+    let chart = screen.getByTestId('slice-container').firstChild.style!;
     expect(chart?.width).toBe('900px');
     expect(chart?.height).toBe('26px');

Review comment:
       ```suggestion
       expect(chart.width).toBe('900px');
       expect(chart.height).toBe('26px');
   ```




-- 
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.

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