You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/05/21 17:23:49 UTC

[GitHub] [superset] michael-s-molina commented on a change in pull request #14741: fix: Additional ResultSet tests

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



##########
File path: superset-frontend/spec/javascripts/sqllab/ResultSet_spec.jsx
##########
@@ -182,3 +183,18 @@ describe('ResultSet', () => {
     });
   });
 });
+
+describe('RTL ResultSet tests', () => {
+  it('renders if there props has no limit in query.results but has queryLimit', () => {
+    render(<ResultSet {...mockedProps} />, { useRedux: true });
+    const grid = screen.getAllByRole('grid');
+    expect(grid.length).toBe(1);

Review comment:
       If there is only one grid expected, then we can use `getBy` instead of `getByAll`.
   ```suggestion
       expect(screen.getByRole('grid')).toBeInTheDocument());
   ```

##########
File path: superset-frontend/spec/javascripts/sqllab/ResultSet_spec.jsx
##########
@@ -19,6 +19,8 @@
 import React from 'react';
 import { shallow } from 'enzyme';
 import { styledMount } from 'spec/helpers/theming';
+import { render } from 'spec/helpers/testing-library';
+import { screen } from '@testing-library/react';

Review comment:
       ```suggestion
   import { render, screen } from 'spec/helpers/testing-library';
   ```

##########
File path: superset-frontend/spec/javascripts/sqllab/ResultSet_spec.jsx
##########
@@ -182,3 +183,18 @@ describe('ResultSet', () => {
     });
   });
 });
+
+describe('RTL ResultSet tests', () => {
+  it('renders if there props has no limit in query.results but has queryLimit', () => {
+    render(<ResultSet {...mockedProps} />, { useRedux: true });
+    const grid = screen.getAllByRole('grid');
+    expect(grid.length).toBe(1);
+  });
+
+  it('Renders if there is a limit in query.results but not queryLimit', () => {
+    const props = { ...mockedProps, query: queryWithNoQueryLimit };
+    render(<ResultSet {...props} />, { useRedux: true });
+    const grid = screen.getAllByRole('grid');
+    expect(grid.length).toBe(1);

Review comment:
       ```suggestion
       expect(screen.getByRole('grid')).toBeInTheDocument());
   ```

##########
File path: superset-frontend/spec/javascripts/sqllab/ResultSet_spec.jsx
##########
@@ -182,3 +183,18 @@ describe('ResultSet', () => {
     });
   });
 });
+
+describe('RTL ResultSet tests', () => {
+  it('renders if there props has no limit in query.results but has queryLimit', () => {
+    render(<ResultSet {...mockedProps} />, { useRedux: true });
+    const grid = screen.getAllByRole('grid');
+    expect(grid.length).toBe(1);
+  });
+
+  it('Renders if there is a limit in query.results but not queryLimit', () => {

Review comment:
       ```suggestion
     it('renders if there is a limit in query.results but not queryLimit', () => {
   ```

##########
File path: superset-frontend/spec/javascripts/sqllab/ResultSet_spec.jsx
##########
@@ -182,3 +183,18 @@ describe('ResultSet', () => {
     });
   });
 });
+
+describe('RTL ResultSet tests', () => {
+  it('renders if there props has no limit in query.results but has queryLimit', () => {

Review comment:
       ```suggestion
     it('renders if there is no limit in query.results but has queryLimit', () => {
   ```




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org