mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
refactor: Upgrade to React 17 (#31961)
This commit is contained in:
committed by
GitHub
parent
aa74ba3da2
commit
7e2b7941f3
@@ -17,8 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import fetchMock from 'fetch-mock';
|
||||
import * as uiCore from '@superset-ui/core';
|
||||
import { FeatureFlag, QueryState } from '@superset-ui/core';
|
||||
import { FeatureFlag, isFeatureEnabled, QueryState } from '@superset-ui/core';
|
||||
import { render, screen, waitFor } from 'spec/helpers/testing-library';
|
||||
import QueryHistory from 'src/SqlLab/components/QueryHistory';
|
||||
import { initialState } from 'src/SqlLab/fixtures';
|
||||
@@ -67,6 +66,13 @@ const fakeApiResult = {
|
||||
],
|
||||
};
|
||||
|
||||
jest.mock('@superset-ui/core', () => ({
|
||||
...jest.requireActual('@superset-ui/core'),
|
||||
isFeatureEnabled: jest.fn(),
|
||||
}));
|
||||
|
||||
const mockedIsFeatureEnabled = isFeatureEnabled as jest.Mock;
|
||||
|
||||
const setup = (overrides = {}) => (
|
||||
<QueryHistory {...mockedProps} {...overrides} />
|
||||
);
|
||||
@@ -82,11 +88,9 @@ test('Renders an empty state for query history', () => {
|
||||
});
|
||||
|
||||
test('fetches the query history when the persistence mode is enabled', async () => {
|
||||
const isFeatureEnabledMock = jest
|
||||
.spyOn(uiCore, 'isFeatureEnabled')
|
||||
.mockImplementation(
|
||||
featureFlag => featureFlag === FeatureFlag.SqllabBackendPersistence,
|
||||
);
|
||||
const isFeatureEnabledMock = mockedIsFeatureEnabled.mockImplementation(
|
||||
featureFlag => featureFlag === FeatureFlag.SqllabBackendPersistence,
|
||||
);
|
||||
|
||||
const editorQueryApiRoute = `glob:*/api/v1/query/?q=*`;
|
||||
fetchMock.get(editorQueryApiRoute, fakeApiResult);
|
||||
|
||||
Reference in New Issue
Block a user