mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
chore: Upgrade AG Grid to use tree shaking (#32334)
This commit is contained in:
committed by
GitHub
parent
793fbac405
commit
479a5d2f72
@@ -27,6 +27,7 @@ import configureStore from 'redux-mock-store';
|
||||
import { Store } from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
import fetchMock from 'fetch-mock';
|
||||
import { setupAGGridModules } from 'src/setup/setupAGGridModules';
|
||||
import ResultSet from 'src/SqlLab/components/ResultSet';
|
||||
import {
|
||||
cachedQuery,
|
||||
@@ -143,6 +144,10 @@ const setup = (props?: any, store?: Store) =>
|
||||
});
|
||||
|
||||
describe('ResultSet', () => {
|
||||
beforeAll(() => {
|
||||
setupAGGridModules();
|
||||
});
|
||||
|
||||
// Add cleanup after each test
|
||||
afterEach(async () => {
|
||||
fetchMock.resetHistory();
|
||||
@@ -363,7 +368,7 @@ describe('ResultSet', () => {
|
||||
);
|
||||
});
|
||||
const { getByRole } = setup(mockedProps, mockStore(initialState));
|
||||
expect(getByRole('treegrid')).toBeInTheDocument();
|
||||
expect(getByRole('grid')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('renders if there is a limit in query.results but not queryLimit', async () => {
|
||||
@@ -381,7 +386,7 @@ describe('ResultSet', () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(getByRole('treegrid')).toBeInTheDocument();
|
||||
expect(getByRole('grid')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Async queries - renders "Fetch data preview" button when data preview has no results', () => {
|
||||
@@ -409,7 +414,7 @@ describe('ResultSet', () => {
|
||||
name: /fetch data preview/i,
|
||||
}),
|
||||
).toBeVisible();
|
||||
expect(screen.queryByRole('treegrid')).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('grid')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Async queries - renders "Refetch results" button when a query has no results', () => {
|
||||
@@ -438,7 +443,7 @@ describe('ResultSet', () => {
|
||||
name: /refetch results/i,
|
||||
}),
|
||||
).toBeVisible();
|
||||
expect(screen.queryByRole('treegrid')).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('grid')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Async queries - renders on the first call', () => {
|
||||
@@ -458,7 +463,7 @@ describe('ResultSet', () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(screen.getByRole('treegrid')).toBeVisible();
|
||||
expect(screen.getByRole('grid')).toBeVisible();
|
||||
expect(
|
||||
screen.queryByRole('button', {
|
||||
name: /fetch data preview/i,
|
||||
|
||||
Reference in New Issue
Block a user