mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
chore: Moves spec files to the src folder - iteration 7 (#16943)
This commit is contained in:
committed by
GitHub
parent
028f6c0d3f
commit
1ab36c94f3
@@ -167,6 +167,7 @@ module.exports = {
|
|||||||
'src/**/*.test.tsx',
|
'src/**/*.test.tsx',
|
||||||
'src/**/*.test.js',
|
'src/**/*.test.js',
|
||||||
'src/**/*.test.jsx',
|
'src/**/*.test.jsx',
|
||||||
|
'src/**/fixtures.*',
|
||||||
],
|
],
|
||||||
plugins: ['jest', 'jest-dom', 'no-only-tests', 'testing-library'],
|
plugins: ['jest', 'jest-dom', 'no-only-tests', 'testing-library'],
|
||||||
env: {
|
env: {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import { user } from 'src/SqlLab/fixtures';
|
||||||
import dashboardInfo from './mockDashboardInfo';
|
import dashboardInfo from './mockDashboardInfo';
|
||||||
import { user } from '../javascripts/sqllab/fixtures';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
active: true,
|
active: true,
|
||||||
|
|||||||
2
superset-frontend/spec/fixtures/mockState.js
vendored
2
superset-frontend/spec/fixtures/mockState.js
vendored
@@ -22,13 +22,13 @@ import {
|
|||||||
nativeFiltersInfo,
|
nativeFiltersInfo,
|
||||||
mockDataMaskInfo,
|
mockDataMaskInfo,
|
||||||
} from 'spec/javascripts/dashboard/fixtures/mockNativeFilters';
|
} from 'spec/javascripts/dashboard/fixtures/mockNativeFilters';
|
||||||
|
import { user } from 'src/SqlLab/fixtures';
|
||||||
import chartQueries from './mockChartQueries';
|
import chartQueries from './mockChartQueries';
|
||||||
import { dashboardLayout } from './mockDashboardLayout';
|
import { dashboardLayout } from './mockDashboardLayout';
|
||||||
import dashboardInfo from './mockDashboardInfo';
|
import dashboardInfo from './mockDashboardInfo';
|
||||||
import { emptyFilters } from './mockDashboardFilters';
|
import { emptyFilters } from './mockDashboardFilters';
|
||||||
import dashboardState from './mockDashboardState';
|
import dashboardState from './mockDashboardState';
|
||||||
import { sliceEntitiesForChart } from './mockSliceEntities';
|
import { sliceEntitiesForChart } from './mockSliceEntities';
|
||||||
import { user } from '../javascripts/sqllab/fixtures';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
datasources,
|
datasources,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import { sliceId } from 'spec/fixtures/mockChartQueries';
|
|||||||
import dashboardInfo from 'spec/fixtures/mockDashboardInfo';
|
import dashboardInfo from 'spec/fixtures/mockDashboardInfo';
|
||||||
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
|
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
|
||||||
import { sliceEntitiesForChart } from 'spec/fixtures/mockSliceEntities';
|
import { sliceEntitiesForChart } from 'spec/fixtures/mockSliceEntities';
|
||||||
import { initialState } from 'spec/javascripts/sqllab/fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
import { nativeFiltersInfo } from '../../fixtures/mockNativeFilters';
|
import { nativeFiltersInfo } from '../../fixtures/mockNativeFilters';
|
||||||
|
|
||||||
describe('ChartHolder', () => {
|
describe('ChartHolder', () => {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
|
|||||||
|
|
||||||
import { getMockStore } from 'spec/fixtures/mockStore';
|
import { getMockStore } from 'spec/fixtures/mockStore';
|
||||||
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
|
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
|
||||||
import { initialState } from 'spec/javascripts/sqllab/fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('Column', () => {
|
describe('Column', () => {
|
||||||
const columnWithoutChildren = {
|
const columnWithoutChildren = {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
|||||||
|
|
||||||
import { getMockStore } from 'spec/fixtures/mockStore';
|
import { getMockStore } from 'spec/fixtures/mockStore';
|
||||||
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
|
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
|
||||||
import { initialState } from 'spec/javascripts/sqllab/fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('Row', () => {
|
describe('Row', () => {
|
||||||
const rowWithoutChildren = { ...mockLayout.present.ROW_ID, children: [] };
|
const rowWithoutChildren = { ...mockLayout.present.ROW_ID, children: [] };
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import Tab, {
|
|||||||
} from 'src/dashboard/components/gridComponents/Tab';
|
} from 'src/dashboard/components/gridComponents/Tab';
|
||||||
import { dashboardLayoutWithTabs } from 'spec/fixtures/mockDashboardLayout';
|
import { dashboardLayoutWithTabs } from 'spec/fixtures/mockDashboardLayout';
|
||||||
import { getMockStore } from 'spec/fixtures/mockStore';
|
import { getMockStore } from 'spec/fixtures/mockStore';
|
||||||
import { initialState } from 'spec/javascripts/sqllab/fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('Tabs', () => {
|
describe('Tabs', () => {
|
||||||
const props = {
|
const props = {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import emptyDashboardLayout from 'src/dashboard/fixtures/emptyDashboardLayout';
|
|||||||
import { dashboardLayoutWithTabs } from 'spec/fixtures/mockDashboardLayout';
|
import { dashboardLayoutWithTabs } from 'spec/fixtures/mockDashboardLayout';
|
||||||
import { getMockStore } from 'spec/fixtures/mockStore';
|
import { getMockStore } from 'spec/fixtures/mockStore';
|
||||||
import { nativeFilters } from 'spec/fixtures/mockNativeFilters';
|
import { nativeFilters } from 'spec/fixtures/mockNativeFilters';
|
||||||
import { initialState } from 'spec/javascripts/sqllab/fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('Tabs', () => {
|
describe('Tabs', () => {
|
||||||
fetchMock.post('glob:*/r/shortner/', {});
|
fetchMock.post('glob:*/r/shortner/', {});
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
AceCompleterKeyword,
|
AceCompleterKeyword,
|
||||||
FullSQLEditor as AceEditor,
|
FullSQLEditor as AceEditor,
|
||||||
} from 'src/components/AsyncAceEditor';
|
} from 'src/components/AsyncAceEditor';
|
||||||
import { QueryEditor } from '../types';
|
import { QueryEditor } from 'src/SqlLab/types';
|
||||||
|
|
||||||
type HotKey = {
|
type HotKey = {
|
||||||
key: string;
|
key: string;
|
||||||
@@ -30,9 +30,9 @@ import {
|
|||||||
LOCALSTORAGE_WARNING_MESSAGE_THROTTLE_MS,
|
LOCALSTORAGE_WARNING_MESSAGE_THROTTLE_MS,
|
||||||
} from 'src/SqlLab/constants';
|
} from 'src/SqlLab/constants';
|
||||||
import * as Actions from 'src/SqlLab/actions/sqlLab';
|
import * as Actions from 'src/SqlLab/actions/sqlLab';
|
||||||
import TabbedSqlEditors from './TabbedSqlEditors';
|
import TabbedSqlEditors from '../TabbedSqlEditors';
|
||||||
import QueryAutoRefresh from './QueryAutoRefresh';
|
import QueryAutoRefresh from '../QueryAutoRefresh';
|
||||||
import QuerySearch from './QuerySearch';
|
import QuerySearch from '../QuerySearch';
|
||||||
|
|
||||||
class App extends React.PureComponent {
|
class App extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -19,8 +19,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { styledMount as mount } from 'spec/helpers/theming';
|
import { styledMount as mount } from 'spec/helpers/theming';
|
||||||
import ColumnElement from 'src/SqlLab/components/ColumnElement';
|
import ColumnElement from 'src/SqlLab/components/ColumnElement';
|
||||||
|
import { mockedActions, table } from 'src/SqlLab/fixtures';
|
||||||
import { mockedActions, table } from './fixtures';
|
|
||||||
|
|
||||||
describe('ColumnElement', () => {
|
describe('ColumnElement', () => {
|
||||||
const mockedProps = {
|
const mockedProps = {
|
||||||
@@ -20,12 +20,11 @@ import React, { useMemo } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Alert from 'src/components/Alert';
|
import Alert from 'src/components/Alert';
|
||||||
import { t } from '@superset-ui/core';
|
import { t } from '@superset-ui/core';
|
||||||
|
|
||||||
import TableView from 'src/components/TableView';
|
import TableView from 'src/components/TableView';
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
import Loading from '../../components/Loading';
|
import Loading from 'src/components/Loading';
|
||||||
import ModalTrigger from '../../components/ModalTrigger';
|
import ModalTrigger from 'src/components/ModalTrigger';
|
||||||
import { EmptyWrapperType } from '../../components/TableView/TableView';
|
import { EmptyWrapperType } from 'src/components/TableView/TableView';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
dbId: PropTypes.number.isRequired,
|
dbId: PropTypes.number.isRequired,
|
||||||
@@ -22,10 +22,9 @@ import { bindActionCreators } from 'redux';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { t } from '@superset-ui/core';
|
import { t } from '@superset-ui/core';
|
||||||
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
||||||
|
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
import { exploreChart } from 'src/explore/exploreUtils';
|
import { exploreChart } from 'src/explore/exploreUtils';
|
||||||
import * as actions from '../actions/sqlLab';
|
import * as actions from 'src/SqlLab/actions/sqlLab';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
actions: PropTypes.object.isRequired,
|
actions: PropTypes.object.isRequired,
|
||||||
@@ -27,8 +27,7 @@ import sqlLabReducer from 'src/SqlLab/reducers/index';
|
|||||||
import ExploreResultsButton from 'src/SqlLab/components/ExploreResultsButton';
|
import ExploreResultsButton from 'src/SqlLab/components/ExploreResultsButton';
|
||||||
import * as exploreUtils from 'src/explore/exploreUtils';
|
import * as exploreUtils from 'src/explore/exploreUtils';
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
|
import { queries, queryWithBadColumns } from 'src/SqlLab/fixtures';
|
||||||
import { queries, queryWithBadColumns } from './fixtures';
|
|
||||||
|
|
||||||
describe('ExploreResultsButton', () => {
|
describe('ExploreResultsButton', () => {
|
||||||
const middlewares = [thunk];
|
const middlewares = [thunk];
|
||||||
@@ -25,9 +25,8 @@ import Alert from 'src/components/Alert';
|
|||||||
import { t } from '@superset-ui/core';
|
import { t } from '@superset-ui/core';
|
||||||
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
|
||||||
import shortid from 'shortid';
|
import shortid from 'shortid';
|
||||||
|
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
import * as actions from '../actions/sqlLab';
|
import * as actions from 'src/SqlLab/actions/sqlLab';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
actions: PropTypes.object.isRequired,
|
actions: PropTypes.object.isRequired,
|
||||||
@@ -21,8 +21,7 @@ import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light';
|
|||||||
import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql';
|
import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql';
|
||||||
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
|
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
|
||||||
import { t } from '@superset-ui/core';
|
import { t } from '@superset-ui/core';
|
||||||
|
import ModalTrigger from 'src/components/ModalTrigger';
|
||||||
import ModalTrigger from '../../components/ModalTrigger';
|
|
||||||
|
|
||||||
SyntaxHighlighter.registerLanguage('sql', sql);
|
SyntaxHighlighter.registerLanguage('sql', sql);
|
||||||
|
|
||||||
@@ -21,9 +21,8 @@ import { shallow } from 'enzyme';
|
|||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import thunk from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import configureStore from 'redux-mock-store';
|
import configureStore from 'redux-mock-store';
|
||||||
|
|
||||||
import QueryAutoRefresh from 'src/SqlLab/components/QueryAutoRefresh';
|
import QueryAutoRefresh from 'src/SqlLab/components/QueryAutoRefresh';
|
||||||
import { initialState, runningQuery } from './fixtures';
|
import { initialState, runningQuery } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('QueryAutoRefresh', () => {
|
describe('QueryAutoRefresh', () => {
|
||||||
const middlewares = [thunk];
|
const middlewares = [thunk];
|
||||||
@@ -21,8 +21,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { SupersetClient } from '@superset-ui/core';
|
import { SupersetClient } from '@superset-ui/core';
|
||||||
|
import * as Actions from 'src/SqlLab/actions/sqlLab';
|
||||||
import * as Actions from '../actions/sqlLab';
|
|
||||||
|
|
||||||
const QUERY_UPDATE_FREQ = 2000;
|
const QUERY_UPDATE_FREQ = 2000;
|
||||||
const QUERY_UPDATE_BUFFER_MS = 5000;
|
const QUERY_UPDATE_BUFFER_MS = 5000;
|
||||||
@@ -19,9 +19,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Alert from 'src/components/Alert';
|
import Alert from 'src/components/Alert';
|
||||||
import { t } from '@superset-ui/core';
|
import { t } from '@superset-ui/core';
|
||||||
|
import { Query } from 'src/SqlLab/types';
|
||||||
import QueryTable from './QueryTable';
|
import QueryTable from 'src/SqlLab/components/QueryTable';
|
||||||
import { Query } from '../types';
|
|
||||||
|
|
||||||
interface QueryHistoryProps {
|
interface QueryHistoryProps {
|
||||||
queries: Query[];
|
queries: Query[];
|
||||||
@@ -26,7 +26,7 @@ import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
|||||||
import { fireEvent, render, screen, act } from '@testing-library/react';
|
import { fireEvent, render, screen, act } from '@testing-library/react';
|
||||||
import '@testing-library/jest-dom/extend-expect';
|
import '@testing-library/jest-dom/extend-expect';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import { user } from './fixtures';
|
import { user } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
const mockStore = configureStore([thunk]);
|
const mockStore = configureStore([thunk]);
|
||||||
const store = mockStore({
|
const store = mockStore({
|
||||||
@@ -21,17 +21,17 @@ import Button from 'src/components/Button';
|
|||||||
import Select from 'src/components/Select';
|
import Select from 'src/components/Select';
|
||||||
import { styled, t, SupersetClient } from '@superset-ui/core';
|
import { styled, t, SupersetClient } from '@superset-ui/core';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import Loading from '../../components/Loading';
|
import Loading from 'src/components/Loading';
|
||||||
import QueryTable from './QueryTable';
|
|
||||||
import {
|
import {
|
||||||
now,
|
now,
|
||||||
epochTimeXHoursAgo,
|
epochTimeXHoursAgo,
|
||||||
epochTimeXDaysAgo,
|
epochTimeXDaysAgo,
|
||||||
epochTimeXYearsAgo,
|
epochTimeXYearsAgo,
|
||||||
} from '../../modules/dates';
|
} from 'src/modules/dates';
|
||||||
import { STATUS_OPTIONS, TIME_OPTIONS } from '../constants';
|
import AsyncSelect from 'src/components/AsyncSelect';
|
||||||
import AsyncSelect from '../../components/AsyncSelect';
|
import { Query } from 'src/SqlLab/types';
|
||||||
import { Query } from '../types';
|
import { STATUS_OPTIONS, TIME_OPTIONS } from 'src/SqlLab/constants';
|
||||||
|
import QueryTable from '../QueryTable';
|
||||||
|
|
||||||
interface QuerySearchProps {
|
interface QuerySearchProps {
|
||||||
actions: {
|
actions: {
|
||||||
@@ -18,9 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Label from 'src/components/Label';
|
import Label from 'src/components/Label';
|
||||||
|
import { STATE_TYPE_MAP } from 'src/SqlLab/constants';
|
||||||
import { STATE_TYPE_MAP } from '../constants';
|
import { Query } from 'src/SqlLab/types';
|
||||||
import { Query } from '../types';
|
|
||||||
|
|
||||||
interface QueryStateLabelProps {
|
interface QueryStateLabelProps {
|
||||||
query: Query;
|
query: Query;
|
||||||
@@ -24,7 +24,7 @@ import QueryTable from 'src/SqlLab/components/QueryTable';
|
|||||||
import TableView from 'src/components/TableView';
|
import TableView from 'src/components/TableView';
|
||||||
import { TableCollection } from 'src/components/dataViewCommon';
|
import { TableCollection } from 'src/components/dataViewCommon';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { queries, user } from './fixtures';
|
import { queries, user } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('QueryTable', () => {
|
describe('QueryTable', () => {
|
||||||
const mockedProps = {
|
const mockedProps = {
|
||||||
@@ -41,7 +41,7 @@ import {
|
|||||||
initialState,
|
initialState,
|
||||||
user,
|
user,
|
||||||
queryWithNoQueryLimit,
|
queryWithNoQueryLimit,
|
||||||
} from './fixtures';
|
} from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
const mockStore = configureStore([thunk]);
|
const mockStore = configureStore([thunk]);
|
||||||
const store = mockStore(initialState);
|
const store = mockStore(initialState);
|
||||||
@@ -36,17 +36,17 @@ import { debounce } from 'lodash';
|
|||||||
import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
|
import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
|
||||||
import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal';
|
import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal';
|
||||||
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
|
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
|
||||||
import Loading from '../../components/Loading';
|
import Loading from 'src/components/Loading';
|
||||||
import ExploreCtasResultsButton from './ExploreCtasResultsButton';
|
import FilterableTable from 'src/components/FilterableTable/FilterableTable';
|
||||||
import ExploreResultsButton from './ExploreResultsButton';
|
import CopyToClipboard from 'src/components/CopyToClipboard';
|
||||||
import HighlightedSql from './HighlightedSql';
|
import { prepareCopyToClipboardTabularData } from 'src/utils/common';
|
||||||
import FilterableTable from '../../components/FilterableTable/FilterableTable';
|
import { exploreChart } from 'src/explore/exploreUtils';
|
||||||
import QueryStateLabel from './QueryStateLabel';
|
import { CtasEnum } from 'src/SqlLab/actions/sqlLab';
|
||||||
import CopyToClipboard from '../../components/CopyToClipboard';
|
import { Query } from 'src/SqlLab/types';
|
||||||
import { prepareCopyToClipboardTabularData } from '../../utils/common';
|
import ExploreCtasResultsButton from '../ExploreCtasResultsButton';
|
||||||
import { exploreChart } from '../../explore/exploreUtils';
|
import ExploreResultsButton from '../ExploreResultsButton';
|
||||||
import { CtasEnum } from '../actions/sqlLab';
|
import HighlightedSql from '../HighlightedSql';
|
||||||
import { Query } from '../types';
|
import QueryStateLabel from '../QueryStateLabel';
|
||||||
|
|
||||||
enum DatasetRadioState {
|
enum DatasetRadioState {
|
||||||
SAVE_NEW = 1,
|
SAVE_NEW = 1,
|
||||||
@@ -24,8 +24,8 @@ import withToasts from 'src/components/MessageToasts/withToasts';
|
|||||||
import CopyToClipboard from 'src/components/CopyToClipboard';
|
import CopyToClipboard from 'src/components/CopyToClipboard';
|
||||||
import { storeQuery } from 'src/utils/common';
|
import { storeQuery } from 'src/utils/common';
|
||||||
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
|
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
|
||||||
import { FeatureFlag, isFeatureEnabled } from '../../featureFlags';
|
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
|
||||||
import { QueryEditor } from '../types';
|
import { QueryEditor } from 'src/SqlLab/types';
|
||||||
|
|
||||||
interface ShareSqlLabQueryPropTypes {
|
interface ShareSqlLabQueryPropTypes {
|
||||||
queryEditor: QueryEditor;
|
queryEditor: QueryEditor;
|
||||||
@@ -20,9 +20,8 @@ import React from 'react';
|
|||||||
import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light';
|
import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light';
|
||||||
import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql';
|
import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql';
|
||||||
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
|
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
|
||||||
|
import { IconTooltip } from 'src/components/IconTooltip';
|
||||||
import { IconTooltip } from '../../components/IconTooltip';
|
import ModalTrigger from 'src/components/ModalTrigger';
|
||||||
import ModalTrigger from '../../components/ModalTrigger';
|
|
||||||
|
|
||||||
SyntaxHighlighter.registerLanguage('sql', sql);
|
SyntaxHighlighter.registerLanguage('sql', sql);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ import SouthPaneContainer from 'src/SqlLab/components/SouthPane/state';
|
|||||||
import ResultSet from 'src/SqlLab/components/ResultSet';
|
import ResultSet from 'src/SqlLab/components/ResultSet';
|
||||||
import '@testing-library/jest-dom/extend-expect';
|
import '@testing-library/jest-dom/extend-expect';
|
||||||
import { STATUS_OPTIONS } from 'src/SqlLab/constants';
|
import { STATUS_OPTIONS } from 'src/SqlLab/constants';
|
||||||
import { initialState } from './fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
const mockedProps = {
|
const mockedProps = {
|
||||||
editorQueries: [
|
editorQueries: [
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators, Dispatch } from 'redux';
|
import { bindActionCreators, Dispatch } from 'redux';
|
||||||
import * as Actions from '../../actions/sqlLab';
|
import * as Actions from 'src/SqlLab/actions/sqlLab';
|
||||||
import SouthPane from './SouthPane';
|
import SouthPane from '.';
|
||||||
|
|
||||||
function mapStateToProps({ sqlLab }: Record<string, any>) {
|
function mapStateToProps({ sqlLab }: Record<string, any>) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import {
|
|||||||
queryEditorSetSchemaOptions,
|
queryEditorSetSchemaOptions,
|
||||||
} from 'src/SqlLab/actions/sqlLab';
|
} from 'src/SqlLab/actions/sqlLab';
|
||||||
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
||||||
import { initialState, queries, table } from './fixtures';
|
import { initialState, queries, table } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
const MOCKED_SQL_EDITOR_HEIGHT = 500;
|
const MOCKED_SQL_EDITOR_HEIGHT = 500;
|
||||||
|
|
||||||
@@ -64,15 +64,15 @@ import {
|
|||||||
SQL_TOOLBAR_HEIGHT,
|
SQL_TOOLBAR_HEIGHT,
|
||||||
} from 'src/SqlLab/constants';
|
} from 'src/SqlLab/constants';
|
||||||
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
|
import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
|
||||||
import TemplateParamsEditor from './TemplateParamsEditor';
|
import TemplateParamsEditor from '../TemplateParamsEditor';
|
||||||
import ConnectedSouthPane from './SouthPane/state';
|
import ConnectedSouthPane from '../SouthPane/state';
|
||||||
import SaveQuery from './SaveQuery';
|
import SaveQuery from '../SaveQuery';
|
||||||
import ScheduleQueryButton from './ScheduleQueryButton';
|
import ScheduleQueryButton from '../ScheduleQueryButton';
|
||||||
import EstimateQueryCostButton from './EstimateQueryCostButton';
|
import EstimateQueryCostButton from '../EstimateQueryCostButton';
|
||||||
import ShareSqlLabQuery from './ShareSqlLabQuery';
|
import ShareSqlLabQuery from '../ShareSqlLabQuery';
|
||||||
import SqlEditorLeftBar from './SqlEditorLeftBar';
|
import SqlEditorLeftBar from '../SqlEditorLeftBar';
|
||||||
import AceEditorWrapper from './AceEditorWrapper';
|
import AceEditorWrapper from '../AceEditorWrapper';
|
||||||
import RunQueryActionButton from './RunQueryActionButton';
|
import RunQueryActionButton from '../RunQueryActionButton';
|
||||||
|
|
||||||
const LIMIT_DROPDOWN = [10, 100, 1000, 10000, 100000];
|
const LIMIT_DROPDOWN = [10, 100, 1000, 10000, 100000];
|
||||||
const SQL_EDITOR_PADDING = 10;
|
const SQL_EDITOR_PADDING = 10;
|
||||||
@@ -34,7 +34,7 @@ import {
|
|||||||
databases,
|
databases,
|
||||||
defaultQueryEditor,
|
defaultQueryEditor,
|
||||||
mockedActions,
|
mockedActions,
|
||||||
} from './fixtures';
|
} from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
const mockedProps = {
|
const mockedProps = {
|
||||||
actions: mockedActions,
|
actions: mockedActions,
|
||||||
@@ -22,9 +22,9 @@ import Button from 'src/components/Button';
|
|||||||
import { t, styled, css } from '@superset-ui/core';
|
import { t, styled, css } from '@superset-ui/core';
|
||||||
import Collapse from 'src/components/Collapse';
|
import Collapse from 'src/components/Collapse';
|
||||||
import Icons from 'src/components/Icons';
|
import Icons from 'src/components/Icons';
|
||||||
import TableElement from './TableElement';
|
import TableSelector from 'src/components/TableSelector';
|
||||||
import TableSelector from '../../components/TableSelector';
|
import { IconTooltip } from 'src/components/IconTooltip';
|
||||||
import { IconTooltip } from '../../components/IconTooltip';
|
import TableElement from '../TableElement';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
queryEditor: PropTypes.object.isRequired,
|
queryEditor: PropTypes.object.isRequired,
|
||||||
@@ -17,8 +17,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { QueryState } from 'src/SqlLab/types';
|
||||||
import { QueryState } from '../types';
|
|
||||||
|
|
||||||
interface TabStatusIconProps {
|
interface TabStatusIconProps {
|
||||||
tabState: QueryState;
|
tabState: QueryState;
|
||||||
@@ -29,8 +29,7 @@ import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
|||||||
import { EditableTabs } from 'src/components/Tabs';
|
import { EditableTabs } from 'src/components/Tabs';
|
||||||
import TabbedSqlEditors from 'src/SqlLab/components/TabbedSqlEditors';
|
import TabbedSqlEditors from 'src/SqlLab/components/TabbedSqlEditors';
|
||||||
import SqlEditor from 'src/SqlLab/components/SqlEditor';
|
import SqlEditor from 'src/SqlLab/components/SqlEditor';
|
||||||
|
import { table, initialState } from 'src/SqlLab/fixtures';
|
||||||
import { table, initialState } from './fixtures';
|
|
||||||
|
|
||||||
fetchMock.get('glob:*/api/v1/database/*', {});
|
fetchMock.get('glob:*/api/v1/database/*', {});
|
||||||
fetchMock.get('glob:*/savedqueryviewapi/api/get/*', {});
|
fetchMock.get('glob:*/savedqueryviewapi/api/get/*', {});
|
||||||
@@ -26,13 +26,12 @@ import { bindActionCreators } from 'redux';
|
|||||||
import URI from 'urijs';
|
import URI from 'urijs';
|
||||||
import { styled, t } from '@superset-ui/core';
|
import { styled, t } from '@superset-ui/core';
|
||||||
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
|
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
|
||||||
|
|
||||||
import { areArraysShallowEqual } from 'src/reduxUtils';
|
import { areArraysShallowEqual } from 'src/reduxUtils';
|
||||||
import { Tooltip } from 'src/components/Tooltip';
|
import { Tooltip } from 'src/components/Tooltip';
|
||||||
import { detectOS } from 'src/utils/common';
|
import { detectOS } from 'src/utils/common';
|
||||||
import * as Actions from '../actions/sqlLab';
|
import * as Actions from 'src/SqlLab/actions/sqlLab';
|
||||||
import SqlEditor from './SqlEditor';
|
import SqlEditor from '../SqlEditor';
|
||||||
import TabStatusIcon from './TabStatusIcon';
|
import TabStatusIcon from '../TabStatusIcon';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
actions: PropTypes.object.isRequired,
|
actions: PropTypes.object.isRequired,
|
||||||
@@ -22,12 +22,11 @@ import { Provider } from 'react-redux';
|
|||||||
import configureStore from 'redux-mock-store';
|
import configureStore from 'redux-mock-store';
|
||||||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||||
import Collapse from 'src/components/Collapse';
|
import Collapse from 'src/components/Collapse';
|
||||||
|
|
||||||
import { IconTooltip } from 'src/components/IconTooltip';
|
import { IconTooltip } from 'src/components/IconTooltip';
|
||||||
import TableElement from 'src/SqlLab/components/TableElement';
|
import TableElement from 'src/SqlLab/components/TableElement';
|
||||||
import ColumnElement from 'src/SqlLab/components/ColumnElement';
|
import ColumnElement from 'src/SqlLab/components/ColumnElement';
|
||||||
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
|
||||||
import { mockedActions, table } from './fixtures';
|
import { mockedActions, table } from 'src/SqlLab/fixtures';
|
||||||
|
|
||||||
describe('TableElement', () => {
|
describe('TableElement', () => {
|
||||||
const mockStore = configureStore([]);
|
const mockStore = configureStore([]);
|
||||||
@@ -24,12 +24,12 @@ import { t, styled } from '@superset-ui/core';
|
|||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
import { Tooltip } from 'src/components/Tooltip';
|
import { Tooltip } from 'src/components/Tooltip';
|
||||||
import CopyToClipboard from '../../components/CopyToClipboard';
|
import CopyToClipboard from 'src/components/CopyToClipboard';
|
||||||
import { IconTooltip } from '../../components/IconTooltip';
|
import { IconTooltip } from 'src/components/IconTooltip';
|
||||||
import ColumnElement, { ColumnKeyTypeType } from './ColumnElement';
|
import ModalTrigger from 'src/components/ModalTrigger';
|
||||||
import ShowSQL from './ShowSQL';
|
import Loading from 'src/components/Loading';
|
||||||
import ModalTrigger from '../../components/ModalTrigger';
|
import ColumnElement, { ColumnKeyTypeType } from '../ColumnElement';
|
||||||
import Loading from '../../components/Loading';
|
import ShowSQL from '../ShowSQL';
|
||||||
|
|
||||||
interface Column {
|
interface Column {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
import sqlLabReducer from 'src/SqlLab/reducers/sqlLab';
|
import sqlLabReducer from 'src/SqlLab/reducers/sqlLab';
|
||||||
import * as actions from 'src/SqlLab/actions/sqlLab';
|
import * as actions from 'src/SqlLab/actions/sqlLab';
|
||||||
import { now } from 'src/modules/dates';
|
import { now } from 'src/modules/dates';
|
||||||
|
|
||||||
import { table, initialState as mockState } from '../fixtures';
|
import { table, initialState as mockState } from '../fixtures';
|
||||||
|
|
||||||
const initialState = mockState.sqlLab;
|
const initialState = mockState.sqlLab;
|
||||||
@@ -23,7 +23,7 @@ import { sliceId as chartId } from 'spec/fixtures/mockChartQueries';
|
|||||||
import { nativeFiltersInfo } from 'spec/javascripts/dashboard/fixtures/mockNativeFilters';
|
import { nativeFiltersInfo } from 'spec/javascripts/dashboard/fixtures/mockNativeFilters';
|
||||||
import newComponentFactory from 'src/dashboard/util/newComponentFactory';
|
import newComponentFactory from 'src/dashboard/util/newComponentFactory';
|
||||||
import { getMockStore } from 'spec/fixtures/mockStore';
|
import { getMockStore } from 'spec/fixtures/mockStore';
|
||||||
import { initialState } from 'spec/javascripts/sqllab/fixtures';
|
import { initialState } from 'src/SqlLab/fixtures';
|
||||||
import { DndProvider } from 'react-dnd';
|
import { DndProvider } from 'react-dnd';
|
||||||
import { HTML5Backend } from 'react-dnd-html5-backend';
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
|||||||
Reference in New Issue
Block a user