chore: Upgrade AG Grid to use tree shaking (#32334)

This commit is contained in:
Kamil Gabryjelski
2025-02-25 19:00:53 +01:00
committed by GitHub
parent 793fbac405
commit 479a5d2f72
8 changed files with 139 additions and 45 deletions

View File

@@ -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,