فهرست منبع

fixed undefined (reading 'data') warning in Statistics.spec.tsx (#2927)

Co-authored-by: davitbejanyan <dbejanyan@provectus.com>
David 2 سال پیش
والد
کامیت
8dc1e00ca2
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      kafka-ui-react-app/src/components/Topics/Topic/Statistics/__test__/Statistics.spec.tsx

+ 6 - 0
kafka-ui-react-app/src/components/Topics/Topic/Statistics/__test__/Statistics.spec.tsx

@@ -32,13 +32,19 @@ describe('Statistics', () => {
     }));
 
     renderComponent();
+
     await expect(screen.getByText('Restart Analysis')).toBeInTheDocument();
     expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
   });
   it('renders Start Analysis button', async () => {
+    // throwing intentional For error boundaries to work
+    jest.spyOn(console, 'error').mockImplementation(() => undefined);
     (useAnalyzeTopic as jest.Mock).mockImplementation(() => ({
       mutateAsync: startMock,
     }));
+    (useTopicAnalysis as jest.Mock).mockImplementation(() => {
+      throw new Error('Error boundary');
+    });
     renderComponent();
     const btn = screen.getByRole('button', { name: 'Start Analysis' });
     expect(btn).toBeInTheDocument();