未验证 提交 22d52ead 编写于 作者: M Michael S. Molina 提交者: GitHub

Fix tests errors and warnings - iteration 5 (#12212) (#12224)

上级 20503f92
...@@ -39,6 +39,7 @@ const datasource = mockDatasource['7__table']; ...@@ -39,6 +39,7 @@ const datasource = mockDatasource['7__table'];
const SAVE_ENDPOINT = 'glob:*/api/v1/dataset/7'; const SAVE_ENDPOINT = 'glob:*/api/v1/dataset/7';
const SAVE_PAYLOAD = { new: 'data' }; const SAVE_PAYLOAD = { new: 'data' };
const SAVE_DATASOURCE_ENDPOINT = 'glob:*/datasource/save/';
const mockedProps = { const mockedProps = {
datasource, datasource,
...@@ -94,6 +95,7 @@ describe('DatasourceModal', () => { ...@@ -94,6 +95,7 @@ describe('DatasourceModal', () => {
it('saves on confirm', async () => { it('saves on confirm', async () => {
const callsP = fetchMock.post(SAVE_ENDPOINT, SAVE_PAYLOAD); const callsP = fetchMock.post(SAVE_ENDPOINT, SAVE_PAYLOAD);
fetchMock.post(SAVE_DATASOURCE_ENDPOINT, {});
act(() => { act(() => {
wrapper wrapper
.find('button[data-test="datasource-modal-save"]') .find('button[data-test="datasource-modal-save"]')
......
...@@ -51,7 +51,7 @@ function setup(overrides) { ...@@ -51,7 +51,7 @@ function setup(overrides) {
const onClose = sinon.spy(); const onClose = sinon.spy();
const props = { const props = {
adhocMetric: sumValueAdhocMetric, adhocMetric: sumValueAdhocMetric,
savedMetric: {}, savedMetric: { metric_name: 'foo', expression: 'COUNT(*)' },
savedMetrics: [], savedMetrics: [],
onChange, onChange,
onClose, onClose,
......
...@@ -34,7 +34,7 @@ const defaultProps = { ...@@ -34,7 +34,7 @@ const defaultProps = {
describe('ColorPickerControl', () => { describe('ColorPickerControl', () => {
let wrapper; let wrapper;
let inst; let inst;
beforeEach(() => { beforeAll(() => {
getCategoricalSchemeRegistry() getCategoricalSchemeRegistry()
.registerValue( .registerValue(
'test', 'test',
......
...@@ -45,7 +45,7 @@ describe('datasourcepanel', () => { ...@@ -45,7 +45,7 @@ describe('datasourcepanel', () => {
datasource, datasource,
}, },
}, },
actions: null, actions: {},
}; };
it('should render', () => { it('should render', () => {
const { container } = render( const { container } = render(
......
...@@ -44,8 +44,10 @@ const mockProps = { ...@@ -44,8 +44,10 @@ const mockProps = {
}, },
timeout: 1000, timeout: 1000,
chart: { chart: {
id: 0,
queryResponse: {}, queryResponse: {},
}, },
chartHeight: '30px',
}; };
describe('ExploreChartHeader', () => { describe('ExploreChartHeader', () => {
......
...@@ -33,7 +33,9 @@ describe('MetricDefinitionOption', () => { ...@@ -33,7 +33,9 @@ describe('MetricDefinitionOption', () => {
} }
it('renders a MetricOption given a saved metric', () => { it('renders a MetricOption given a saved metric', () => {
const wrapper = setup({ option: { metric_name: 'a_saved_metric' } }); const wrapper = setup({
option: { metric_name: 'a_saved_metric', expression: 'COUNT(*)' },
});
expect(wrapper.find(MetricOption)).toExist(); expect(wrapper.find(MetricOption)).toExist();
}); });
......
...@@ -33,7 +33,11 @@ const sumValueAdhocMetric = new AdhocMetric({ ...@@ -33,7 +33,11 @@ const sumValueAdhocMetric = new AdhocMetric({
describe('MetricDefinitionValue', () => { describe('MetricDefinitionValue', () => {
it('renders a MetricOption given a saved metric', () => { it('renders a MetricOption given a saved metric', () => {
const wrapper = shallow( const wrapper = shallow(
<MetricDefinitionValue option={{ metric_name: 'a_saved_metric' }} />, <MetricDefinitionValue
onMetricEdit={() => {}}
option={{ metric_name: 'a_saved_metric', expression: 'COUNT(*)' }}
index={1}
/>,
); );
expect(wrapper.find('AdhocMetricOption')).toExist(); expect(wrapper.find('AdhocMetricOption')).toExist();
}); });
...@@ -43,6 +47,7 @@ describe('MetricDefinitionValue', () => { ...@@ -43,6 +47,7 @@ describe('MetricDefinitionValue', () => {
<MetricDefinitionValue <MetricDefinitionValue
onMetricEdit={() => {}} onMetricEdit={() => {}}
option={sumValueAdhocMetric} option={sumValueAdhocMetric}
index={1}
/>, />,
); );
expect(wrapper.find(AdhocMetricOption)).toExist(); expect(wrapper.find(AdhocMetricOption)).toExist();
......
...@@ -55,6 +55,7 @@ describe('SqlEditor', () => { ...@@ -55,6 +55,7 @@ describe('SqlEditor', () => {
dataPreviewQueries: [], dataPreviewQueries: [],
defaultQueryLimit: 1000, defaultQueryLimit: 1000,
maxRow: 100000, maxRow: 100000,
displayLimit: 100,
}; };
const buildWrapper = (props = {}) => const buildWrapper = (props = {}) =>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册