chore: move fixtures and helpers to root (#11812)

This commit is contained in:
Elizabeth Thompson
2020-11-30 14:23:56 -08:00
committed by GitHub
parent 011724750f
commit 84e0606a90
34 changed files with 59 additions and 59 deletions

View File

@@ -20,7 +20,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import CollectionTable from 'src/CRUD/CollectionTable';
import mockDatasource from '../../fixtures/mockDatasource';
import mockDatasource from 'spec/fixtures/mockDatasource';
const props = {
collection: mockDatasource['7__table'].columns,

View File

@@ -29,9 +29,9 @@ import { DASHBOARD_GRID_ID } from 'src/dashboard/util/constants';
import {
filterId,
sliceEntitiesForDashboard as sliceEntities,
} from '../fixtures/mockSliceEntities';
import { emptyFilters } from '../fixtures/mockDashboardFilters';
import mockDashboardData from '../fixtures/mockDashboardData';
} from 'spec/fixtures/mockSliceEntities';
import { emptyFilters } from 'spec/fixtures/mockDashboardFilters';
import mockDashboardData from 'spec/fixtures/mockDashboardData';
describe('dashboardState actions', () => {
const mockState = {

View File

@@ -33,13 +33,13 @@ import DashboardHeader from 'src/dashboard/containers/DashboardHeader';
import DashboardGrid from 'src/dashboard/containers/DashboardGrid';
import * as dashboardStateActions from 'src/dashboard/actions/dashboardState';
import WithDragDropContext from '../helpers/WithDragDropContext';
import {
dashboardLayout as undoableDashboardLayout,
dashboardLayoutWithTabs as undoableDashboardLayoutWithTabs,
} from '../fixtures/mockDashboardLayout';
} from 'spec/fixtures/mockDashboardLayout';
import { mockStore, mockStoreWithTabs } from '../fixtures/mockStore';
import { mockStore, mockStoreWithTabs } from 'spec/fixtures/mockStore';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
const dashboardLayout = undoableDashboardLayout.present;
const layoutWithTabs = undoableDashboardLayoutWithTabs.present;

View File

@@ -26,12 +26,12 @@ import { CHART_TYPE } from 'src/dashboard/util/componentTypes';
import newComponentFactory from 'src/dashboard/util/newComponentFactory';
// mock data
import chartQueries from '../fixtures/mockChartQueries';
import datasources from '../../../fixtures/mockDatasource';
import dashboardInfo from '../fixtures/mockDashboardInfo';
import { dashboardLayout } from '../fixtures/mockDashboardLayout';
import dashboardState from '../fixtures/mockDashboardState';
import { sliceEntitiesForChart as sliceEntities } from '../fixtures/mockSliceEntities';
import chartQueries from 'spec/fixtures/mockChartQueries';
import datasources from 'spec/fixtures/mockDatasource';
import dashboardInfo from 'spec/fixtures/mockDashboardInfo';
import { dashboardLayout } from 'spec/fixtures/mockDashboardLayout';
import dashboardState from 'spec/fixtures/mockDashboardState';
import { sliceEntitiesForChart as sliceEntities } from 'spec/fixtures/mockSliceEntities';
describe('Dashboard', () => {
const props = {

View File

@@ -23,10 +23,10 @@ import * as SupersetUI from '@superset-ui/core';
import { CHART_UPDATE_SUCCEEDED } from 'src/chart/chartAction';
import { buildActiveFilters } from 'src/dashboard/util/activeDashboardFilters';
import FiltersBadge from 'src/dashboard/containers/FiltersBadge';
import { getMockStoreWithFilters } from '../fixtures/mockStore';
import { sliceId } from '../fixtures/mockChartQueries';
import { dashboardFilters } from '../fixtures/mockDashboardFilters';
import { dashboardWithFilter } from '../fixtures/mockDashboardLayout';
import { getMockStoreWithFilters } from 'spec/fixtures/mockStore';
import { sliceId } from 'spec/fixtures/mockChartQueries';
import { dashboardFilters } from 'spec/fixtures/mockDashboardFilters';
import { dashboardWithFilter } from 'spec/fixtures/mockDashboardLayout';
describe('FiltersBadge', () => {
// there's this bizarre "active filters" thing

View File

@@ -28,7 +28,7 @@ import {
import Modal from 'src/common/components/Modal';
import PropertiesModal from 'src/dashboard/components/PropertiesModal';
import { mockStore } from '../fixtures/mockStore';
import { mockStore } from 'spec/fixtures/mockStore';
const dashboardResult = {
json: {

View File

@@ -23,7 +23,7 @@ import sinon from 'sinon';
import { List } from 'react-virtualized';
import SliceAdder from 'src/dashboard/components/SliceAdder';
import { sliceEntitiesForDashboard as mockSliceEntities } from '../fixtures/mockSliceEntities';
import { sliceEntitiesForDashboard as mockSliceEntities } from 'spec/fixtures/mockSliceEntities';
describe('SliceAdder', () => {
const mockEvent = {

View File

@@ -29,10 +29,10 @@ import DragDroppable from 'src/dashboard/components/dnd/DragDroppable';
import HoverMenu from 'src/dashboard/components/menu/HoverMenu';
import ResizableContainer from 'src/dashboard/components/resizable/ResizableContainer';
import { mockStore } from '../../fixtures/mockStore';
import { sliceId } from '../../fixtures/mockChartQueries';
import { dashboardLayout as mockLayout } from '../../fixtures/mockDashboardLayout';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import { mockStore } from 'spec/fixtures/mockStore';
import { sliceId } from 'spec/fixtures/mockChartQueries';
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
describe('ChartHolder', () => {
const props = {

View File

@@ -24,11 +24,11 @@ import Chart from 'src/dashboard/components/gridComponents/Chart';
import SliceHeader from 'src/dashboard/components/SliceHeader';
import ChartContainer from 'src/chart/ChartContainer';
import mockDatasource from '../../../../fixtures/mockDatasource';
import { sliceEntitiesForChart as sliceEntities } from '../../fixtures/mockSliceEntities';
import { sliceEntitiesForChart as sliceEntities } from 'spec/fixtures/mockSliceEntities';
import mockDatasource from 'spec/fixtures/mockDatasource';
import chartQueries, {
sliceId as queryId,
} from '../../fixtures/mockChartQueries';
} from 'spec/fixtures/mockChartQueries';
describe('Chart', () => {
const props = {

View File

@@ -32,9 +32,9 @@ import IconButton from 'src/dashboard/components/IconButton';
import ResizableContainer from 'src/dashboard/components/resizable/ResizableContainer';
import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
import { mockStore } from '../../fixtures/mockStore';
import { dashboardLayout as mockLayout } from '../../fixtures/mockDashboardLayout';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
import { mockStore } from 'spec/fixtures/mockStore';
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
describe('Column', () => {
const columnWithoutChildren = {

View File

@@ -30,7 +30,7 @@ import {
DASHBOARD_GRID_TYPE,
} from 'src/dashboard/util/componentTypes';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
describe('Divider', () => {
const props = {

View File

@@ -33,8 +33,8 @@ import {
DASHBOARD_GRID_TYPE,
} from 'src/dashboard/util/componentTypes';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import { mockStoreWithTabs } from '../../fixtures/mockStore';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
import { mockStoreWithTabs } from 'spec/fixtures/mockStore';
describe('Header', () => {
const props = {

View File

@@ -30,9 +30,9 @@ import DragDroppable from 'src/dashboard/components/dnd/DragDroppable';
import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
import ResizableContainer from 'src/dashboard/components/resizable/ResizableContainer';
import { mockStore } from '../../fixtures/mockStore';
import { dashboardLayout as mockLayout } from '../../fixtures/mockDashboardLayout';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
import { mockStore } from 'spec/fixtures/mockStore';
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
describe('Markdown', () => {
const props = {

View File

@@ -32,9 +32,9 @@ import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
import { DASHBOARD_GRID_ID } from 'src/dashboard/util/constants';
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import { mockStore } from '../../fixtures/mockStore';
import { dashboardLayout as mockLayout } from '../../fixtures/mockDashboardLayout';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
import { mockStore } from 'spec/fixtures/mockStore';
import { dashboardLayout as mockLayout } from 'spec/fixtures/mockDashboardLayout';
describe('Row', () => {
const rowWithoutChildren = { ...mockLayout.present.ROW_ID, children: [] };

View File

@@ -28,9 +28,9 @@ import Tab, {
RENDER_TAB,
RENDER_TAB_CONTENT,
} from 'src/dashboard/components/gridComponents/Tab';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import { dashboardLayoutWithTabs } from '../../fixtures/mockDashboardLayout';
import { mockStoreWithTabs } from '../../fixtures/mockStore';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
import { dashboardLayoutWithTabs } from 'spec/fixtures/mockDashboardLayout';
import { mockStoreWithTabs } from 'spec/fixtures/mockStore';
describe('Tabs', () => {
const props = {

View File

@@ -30,9 +30,9 @@ import HoverMenu from 'src/dashboard/components/menu/HoverMenu';
import DragDroppable from 'src/dashboard/components/dnd/DragDroppable';
import Tabs from 'src/dashboard/components/gridComponents/Tabs';
import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants';
import WithDragDropContext from '../../helpers/WithDragDropContext';
import { dashboardLayoutWithTabs } from '../../fixtures/mockDashboardLayout';
import { mockStoreWithTabs } from '../../fixtures/mockStore';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
import { dashboardLayoutWithTabs } from 'spec/fixtures/mockDashboardLayout';
import { mockStoreWithTabs } from 'spec/fixtures/mockStore';
describe('Tabs', () => {
const props = {

View File

@@ -26,7 +26,7 @@ import {
NEW_COMPONENT_SOURCE_TYPE,
CHART_TYPE,
} from 'src/dashboard/util/componentTypes';
import WithDragDropContext from '../../../helpers/WithDragDropContext';
import WithDragDropContext from 'spec/helpers/WithDragDropContext';
describe('DraggableNewComponent', () => {
const props = {

View File

@@ -1,79 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { datasourceId } from '../../../fixtures/mockDatasource';
export const sliceId = 18;
export default {
[sliceId]: {
id: sliceId,
chartAlert: null,
chartStatus: 'rendered',
chartUpdateEndTime: 1525852456388,
chartUpdateStartTime: 1525852454838,
latestQueryFormData: {},
queryRequest: {},
queryResponse: {},
triggerQuery: false,
lastRendered: 0,
form_data: {
slice_id: sliceId,
viz_type: 'pie',
row_limit: 50000,
metric: 'sum__num',
since: '100 years ago',
groupby: ['gender'],
metrics: ['sum__num'],
compare_lag: '10',
limit: '25',
until: 'now',
granularity: 'ds',
markup_type: 'markdown',
where: '',
compare_suffix: 'o10Y',
datasource: datasourceId,
},
formData: {
datasource: datasourceId,
viz_type: 'pie',
slice_id: sliceId,
granularity_sqla: null,
time_grain_sqla: null,
since: '100 years ago',
until: 'now',
metrics: ['sum__num'],
groupby: ['gender'],
limit: '25',
pie_label_type: 'key',
donut: false,
show_legend: true,
labels_outside: true,
color_scheme: 'bnbColors',
where: '',
having: '',
filters: [],
row_limit: 50000,
metric: 'sum__num',
compare_lag: '10',
granularity: 'ds',
markup_type: 'markdown',
compare_suffix: 'o10Y',
},
},
};

View File

@@ -1,28 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { dashboardLayout } from './mockDashboardLayout';
// mock the object to be posted to save_dash or copy_dash API
export default {
css: '',
dashboard_title: 'Test 1',
default_filters: {},
expanded_slices: {},
positions: dashboardLayout.present,
};

View File

@@ -1,50 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { DASHBOARD_FILTER_SCOPE_GLOBAL } from 'src/dashboard/reducers/dashboardFilters';
import { filterId } from './mockSliceEntities';
export const emptyFilters = {};
export const dashboardFilters = {
[filterId]: {
chartId: filterId,
componentId: 'CHART-rwDfbGqeEn',
directPathToFilter: [
'ROOT_ID',
'TABS-VPEX_c476g',
'TAB-PMJyKM1yB',
'TABS-YdylzDMTMQ',
'TAB-O9AaU9FT0',
'ROW-l6PrlhwSjh',
'CHART-rwDfbGqeEn',
],
scopes: {
region: DASHBOARD_FILTER_SCOPE_GLOBAL,
gender: DASHBOARD_FILTER_SCOPE_GLOBAL,
},
isDateFilter: false,
isInstantFilter: true,
columns: {
region: ['a', 'b'],
},
labels: {
region: 'region',
},
},
};

View File

@@ -1,30 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export default {
id: 1234,
slug: 'dashboardSlug',
metadata: {},
userId: 'mock_user_id',
dash_edit_perm: true,
dash_save_perm: true,
common: {
flash_messages: [],
conf: { ENABLE_JAVASCRIPT_CONTROLS: false, SUPERSET_WEBSERVER_TIMEOUT: 60 },
},
};

View File

@@ -1,260 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {
DASHBOARD_GRID_TYPE,
DASHBOARD_HEADER_TYPE,
DASHBOARD_ROOT_TYPE,
TABS_TYPE,
TAB_TYPE,
CHART_TYPE,
ROW_TYPE,
COLUMN_TYPE,
MARKDOWN_TYPE,
} from 'src/dashboard/util/componentTypes';
import {
DASHBOARD_ROOT_ID,
DASHBOARD_HEADER_ID,
DASHBOARD_GRID_ID,
} from 'src/dashboard/util/constants';
import newComponentFactory from 'src/dashboard/util/newComponentFactory';
import { sliceId as chartId } from './mockChartQueries';
import { filterId } from './mockSliceEntities';
export const sliceId = chartId;
export const dashboardLayout = {
past: [],
present: {
[DASHBOARD_ROOT_ID]: {
type: DASHBOARD_ROOT_TYPE,
id: DASHBOARD_ROOT_ID,
children: [DASHBOARD_GRID_ID],
},
[DASHBOARD_GRID_ID]: {
type: DASHBOARD_GRID_TYPE,
id: DASHBOARD_GRID_ID,
children: ['ROW_ID'],
meta: {},
},
[DASHBOARD_HEADER_ID]: {
type: DASHBOARD_HEADER_TYPE,
id: DASHBOARD_HEADER_ID,
meta: {
text: 'New dashboard',
},
},
ROW_ID: {
...newComponentFactory(ROW_TYPE),
id: 'ROW_ID',
children: ['COLUMN_ID'],
},
COLUMN_ID: {
...newComponentFactory(COLUMN_TYPE),
id: 'COLUMN_ID',
children: ['CHART_ID'],
},
CHART_ID: {
...newComponentFactory(CHART_TYPE),
id: 'CHART_ID',
meta: {
chartId,
width: 3,
height: 10,
chartName: 'Mock chart name',
},
},
MARKDOWN_ID: {
...newComponentFactory(MARKDOWN_TYPE),
id: 'MARKDOWN_ID',
},
},
future: [],
};
export const dashboardLayoutWithTabs = {
past: [],
present: {
[DASHBOARD_ROOT_ID]: {
type: DASHBOARD_ROOT_TYPE,
id: DASHBOARD_ROOT_ID,
children: ['TABS_ID'],
},
TABS_ID: {
id: 'TABS_ID',
type: TABS_TYPE,
children: ['TAB_ID', 'TAB_ID2'],
parents: ['ROOT_ID'],
},
TAB_ID: {
id: 'TAB_ID',
type: TAB_TYPE,
children: ['ROW_ID'],
parents: ['ROOT_ID', 'TABS_ID'],
meta: {
text: 'tab1',
},
},
TAB_ID2: {
id: 'TAB_ID2',
type: TAB_TYPE,
children: ['ROW_ID2'],
parents: ['ROOT_ID', 'TABS_ID'],
meta: {
text: 'tab2',
},
},
CHART_ID: {
...newComponentFactory(CHART_TYPE),
id: 'CHART_ID',
parents: ['ROOT_ID', 'TABS_ID', 'TAB_ID', 'ROW_ID'],
meta: {
chartId,
width: 3,
height: 10,
chartName: 'Mock chart name',
},
},
ROW_ID: {
...newComponentFactory(ROW_TYPE),
id: 'ROW_ID',
children: ['CHART_ID'],
parents: ['ROOT_ID', 'TABS_ID', 'TAB_ID'],
},
CHART_ID2: {
...newComponentFactory(CHART_TYPE),
id: 'CHART_ID2',
parents: ['ROOT_ID', 'TABS_ID', 'TAB_ID2', 'ROW_ID2'],
meta: {
chartId,
width: 3,
height: 10,
chartName: 'Mock chart name 2',
},
},
ROW_ID2: {
...newComponentFactory(ROW_TYPE),
id: 'ROW_ID2',
children: ['CHART_ID2'],
parents: ['ROOT_ID', 'TABS_ID', 'TAB_ID2'],
},
[DASHBOARD_GRID_ID]: {
type: DASHBOARD_GRID_TYPE,
id: DASHBOARD_GRID_ID,
children: [],
parents: ['ROOT_ID'],
meta: {},
},
[DASHBOARD_HEADER_ID]: {
type: DASHBOARD_HEADER_TYPE,
id: DASHBOARD_HEADER_ID,
meta: {
text: 'New dashboard',
},
},
},
future: [],
};
export const filterComponent = {
...newComponentFactory(CHART_TYPE),
id: 'CHART-rwDfbGqeEn',
parents: [
'ROOT_ID',
'TABS-VPEX_c476g',
'TAB-PMJyKM1yB',
'TABS-YdylzDMTMQ',
'TAB-O9AaU9FT0',
'ROW-l6PrlhwSjh',
],
meta: {
chartId: filterId,
width: 3,
height: 10,
sliceName: 'Filter',
},
};
export const dashboardWithFilter = {
[DASHBOARD_ROOT_ID]: {
type: DASHBOARD_ROOT_TYPE,
id: DASHBOARD_ROOT_ID,
children: [DASHBOARD_GRID_ID],
},
[DASHBOARD_GRID_ID]: {
type: DASHBOARD_GRID_TYPE,
id: DASHBOARD_GRID_ID,
children: ['ROW_ID'],
meta: {},
},
[DASHBOARD_HEADER_ID]: {
type: DASHBOARD_HEADER_TYPE,
id: DASHBOARD_HEADER_ID,
meta: {
text: 'New dashboard',
},
},
ROW_ID: {
...newComponentFactory(ROW_TYPE),
id: 'ROW_ID',
children: ['CHART_ID', 'FILTER_ID'],
},
FILTER_ID: {
...newComponentFactory(CHART_TYPE),
id: 'FILTER_ID',
meta: {
chartId: filterId,
width: 3,
height: 10,
chartName: 'filter name',
},
},
CHART_ID: {
...newComponentFactory(CHART_TYPE),
id: 'CHART_ID',
meta: {
chartId,
width: 3,
height: 10,
chartName: 'Mock chart name',
},
},
};

View File

@@ -1,31 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { sliceId } from './mockChartQueries';
export default {
sliceIds: [sliceId],
expandedSlices: {},
editMode: false,
hasUnsavedChanges: false,
maxUndoHistoryExceeded: false,
isStarred: true,
isPublished: true,
css: '',
focusedFilterField: null,
};

View File

@@ -1,210 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { datasourceId } from '../../../fixtures/mockDatasource';
import { sliceId } from './mockChartQueries';
export const filterId = 127;
export const column = 'region';
export const sliceEntitiesForChart = {
slices: {
[sliceId]: {
slice_id: sliceId,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%2018%7D',
slice_name: 'Genders',
form_data: {
slice_id: sliceId,
viz_type: 'pie',
row_limit: 50000,
metric: 'sum__num',
since: '100 years ago',
groupby: ['gender'],
metrics: ['sum__num'],
compare_lag: '10',
limit: '25',
until: 'now',
granularity: 'ds',
markup_type: 'markdown',
where: '',
compare_suffix: 'o10Y',
datasource: datasourceId,
},
edit_url: `/chart/edit/${sliceId}`,
viz_type: 'pie',
datasource: datasourceId,
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332615,
},
},
isLoading: false,
errorMessage: null,
lastUpdated: 0,
};
export const sliceEntitiesForDashboard = {
slices: {
[filterId]: {
slice_id: filterId,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20127%7D',
slice_name: 'Region Filter',
form_data: {
instant_filtering: true,
filter_configs: [
{
asc: true,
clearable: true,
column,
key: 'JknLrSlNL',
multiple: true,
label: column,
},
],
},
edit_url: '/chart/edit/127',
viz_type: 'filter_box',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332615,
},
128: {
slice_id: 128,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20128%7D',
slice_name: "World's Population",
form_data: {},
edit_url: '/chart/edit/128',
viz_type: 'big_number',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332628,
},
129: {
slice_id: 129,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20129%7D',
slice_name: 'Most Populated Countries',
form_data: {},
edit_url: '/chart/edit/129',
viz_type: 'table',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332637,
},
130: {
slice_id: 130,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20130%7D',
slice_name: 'Growth Rate',
form_data: {},
edit_url: '/chart/edit/130',
viz_type: 'line',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332645,
},
131: {
slice_id: 131,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20131%7D',
slice_name: '% Rural',
form_data: {},
edit_url: '/chart/edit/131',
viz_type: 'world_map',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332654,
},
132: {
slice_id: 132,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20132%7D',
slice_name: 'Life Expectancy VS Rural %',
form_data: {},
edit_url: '/chart/edit/132',
viz_type: 'bubble',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332663,
},
133: {
slice_id: 133,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20133%7D',
slice_name: 'Rural Breakdown',
form_data: {},
edit_url: '/chart/edit/133',
viz_type: 'sunburst',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332673,
},
134: {
slice_id: 134,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20134%7D',
slice_name: "World's Pop Growth",
form_data: {},
edit_url: '/chart/edit/134',
viz_type: 'area',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332680,
},
135: {
slice_id: 135,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20135%7D',
slice_name: 'Box plot',
form_data: {},
edit_url: '/chart/edit/135',
viz_type: 'box_plot',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332688,
},
136: {
slice_id: 136,
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20136%7D',
slice_name: 'Treemap',
form_data: {},
edit_url: '/chart/edit/136',
viz_type: 'treemap',
datasource: '2__table',
description: null,
description_markeddown: '',
modified: '23 hours ago',
changed_on: 1529453332700,
},
},
isLoading: false,
errorMessage: null,
lastUpdated: 0,
};

View File

@@ -1,38 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import chartQueries from './mockChartQueries';
import { dashboardLayout } from './mockDashboardLayout';
import dashboardInfo from './mockDashboardInfo';
import { emptyFilters } from './mockDashboardFilters';
import dashboardState from './mockDashboardState';
import messageToasts from '../../messageToasts/mockMessageToasts';
import datasources from '../../../fixtures/mockDatasource';
import sliceEntities from './mockSliceEntities';
export default {
datasources,
sliceEntities,
charts: chartQueries,
dashboardInfo,
dashboardFilters: emptyFilters,
dashboardState,
dashboardLayout,
messageToasts,
impressionId: 'mock_impression_id',
};

View File

@@ -1,76 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from 'src/dashboard/reducers/index';
import mockState from './mockState';
import { dashboardLayoutWithTabs } from './mockDashboardLayout';
import { sliceId } from './mockChartQueries';
import { dashboardFilters } from './mockDashboardFilters';
export const getMockStore = () =>
createStore(rootReducer, mockState, compose(applyMiddleware(thunk)));
export const mockStore = getMockStore();
export const getMockStoreWithTabs = () =>
createStore(
rootReducer,
{
...mockState,
dashboardLayout: dashboardLayoutWithTabs,
dashboardFilters: {},
},
compose(applyMiddleware(thunk)),
);
export const mockStoreWithTabs = getMockStoreWithTabs();
export const sliceIdWithAppliedFilter = sliceId + 1;
export const sliceIdWithRejectedFilter = sliceId + 2;
// has one chart with a filter that has been applied,
// one chart with a filter that has been rejected,
// and one chart with no filters set.
export const getMockStoreWithFilters = () =>
createStore(rootReducer, {
...mockState,
dashboardFilters,
charts: {
...mockState.charts,
[sliceIdWithAppliedFilter]: {
...mockState.charts[sliceId],
queryResponse: {
status: 'success',
applied_filters: [{ column: 'region' }],
rejected_filters: [],
},
},
[sliceIdWithRejectedFilter]: {
...mockState.charts[sliceId],
queryResponse: {
status: 'success',
applied_filters: [],
rejected_filters: [{ column: 'region', reason: 'not_in_datasource' }],
},
},
},
});

View File

@@ -1,45 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import getDragDropManager from 'src/dashboard/util/getDragDropManager';
// A helper component that provides a DragDropContext for components that require it
class WithDragDropContext extends React.Component {
getChildContext() {
return {
dragDropManager: this.context.dragDropManager || getDragDropManager(),
};
}
render() {
return this.props.children;
}
}
WithDragDropContext.propTypes = {
children: PropTypes.node.isRequired,
};
WithDragDropContext.childContextTypes = {
dragDropManager: PropTypes.object.isRequired,
};
export default WithDragDropContext;

View File

@@ -30,13 +30,13 @@ import * as activeDashboardFilters from 'src/dashboard/util/activeDashboardFilte
import {
emptyFilters,
dashboardFilters,
} from '../fixtures/mockDashboardFilters';
} from 'spec/fixtures/mockDashboardFilters';
import {
sliceEntitiesForDashboard,
filterId,
column,
} from '../fixtures/mockSliceEntities';
import { filterComponent } from '../fixtures/mockDashboardLayout';
} from 'spec/fixtures/mockSliceEntities';
import { filterComponent } from 'spec/fixtures/mockDashboardLayout';
describe('dashboardFilters reducer', () => {
const { form_data } = sliceEntitiesForDashboard.slices[filterId];

View File

@@ -17,8 +17,8 @@
* under the License.
*/
import getLeafComponentIdFromPath from 'src/dashboard/util/getLeafComponentIdFromPath';
import { filterId } from '../fixtures/mockSliceEntities';
import { dashboardFilters } from '../fixtures/mockDashboardFilters';
import { filterId } from 'spec/fixtures/mockSliceEntities';
import { dashboardFilters } from 'spec/fixtures/mockDashboardFilters';
describe('getLeafComponentIdFromPath', () => {
const path = dashboardFilters[filterId].directPathToFilter;

View File

@@ -21,7 +21,7 @@ import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants';
import {
dashboardLayout,
dashboardLayoutWithTabs,
} from '../fixtures/mockDashboardLayout';
} from 'spec/fixtures/mockDashboardLayout';
describe('updateComponentParentsList', () => {
const emptyLayout = {

View File

@@ -27,7 +27,7 @@ import { act } from 'react-dom/test-utils';
import Modal from 'src/common/components/Modal';
import ChangeDatasourceModal from 'src/datasource/ChangeDatasourceModal';
import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import mockDatasource from '../../fixtures/mockDatasource';
import mockDatasource from 'spec/fixtures/mockDatasource';
const mockStore = configureStore([thunk]);
const store = mockStore({});

View File

@@ -25,7 +25,7 @@ import thunk from 'redux-thunk';
import Tabs from 'src/common/components/Tabs';
import DatasourceEditor from 'src/datasource/DatasourceEditor';
import Field from 'src/CRUD/Field';
import mockDatasource from '../../fixtures/mockDatasource';
import mockDatasource from 'spec/fixtures/mockDatasource';
const props = {
datasource: mockDatasource['7__table'],

View File

@@ -30,7 +30,7 @@ import Modal from 'src/common/components/Modal';
import DatasourceModal from 'src/datasource/DatasourceModal';
import DatasourceEditor from 'src/datasource/DatasourceEditor';
import * as featureFlags from 'src/featureFlags';
import mockDatasource from '../../fixtures/mockDatasource';
import mockDatasource from 'spec/fixtures/mockDatasource';
const mockStore = configureStore([thunk]);
const store = mockStore({});

View File

@@ -24,7 +24,7 @@ import { shallow } from 'enzyme';
import Popover from 'src/common/components/Popover';
import FilterBoxItemControl from 'src/explore/components/controls/FilterBoxItemControl';
import FormRow from 'src/components/FormRow';
import datasources from '../../../fixtures/mockDatasource';
import datasources from 'spec/fixtures/mockDatasource';
const defaultProps = {
label: 'some label',