Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const datasource = mockDatasource['7__table'];

const SAVE_ENDPOINT = 'glob:*/api/v1/dataset/7';
const SAVE_PAYLOAD = { new: 'data' };
const SAVE_DATASOURCE_ENDPOINT = 'glob:*/datasource/save/';

const mockedProps = {
datasource,
Expand Down Expand Up @@ -94,6 +95,7 @@ describe('DatasourceModal', () => {

it('saves on confirm', async () => {
const callsP = fetchMock.post(SAVE_ENDPOINT, SAVE_PAYLOAD);
fetchMock.post(SAVE_DATASOURCE_ENDPOINT, {});
act(() => {
wrapper
.find('button[data-test="datasource-modal-save"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function setup(overrides) {
const onClose = sinon.spy();
const props = {
adhocMetric: sumValueAdhocMetric,
savedMetric: {},
savedMetric: { metric_name: 'foo', expression: 'COUNT(*)' },
savedMetrics: [],
onChange,
onClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const defaultProps = {
describe('ColorPickerControl', () => {
let wrapper;
let inst;
beforeEach(() => {
beforeAll(() => {
getCategoricalSchemeRegistry()
.registerValue(
'test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('datasourcepanel', () => {
datasource,
},
},
actions: null,
actions: {},
};
it('should render', () => {
const { container } = render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ const mockProps = {
},
timeout: 1000,
chart: {
id: 0,
queryResponse: {},
},
chartHeight: '30px',
};

describe('ExploreChartHeader', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ describe('MetricDefinitionOption', () => {
}

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();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ const sumValueAdhocMetric = new AdhocMetric({
describe('MetricDefinitionValue', () => {
it('renders a MetricOption given a saved metric', () => {
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();
});
Expand All @@ -43,6 +47,7 @@ describe('MetricDefinitionValue', () => {
<MetricDefinitionValue
onMetricEdit={() => {}}
option={sumValueAdhocMetric}
index={1}
/>,
);
expect(wrapper.find(AdhocMetricOption)).toExist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('SqlEditor', () => {
dataPreviewQueries: [],
defaultQueryLimit: 1000,
maxRow: 100000,
displayLimit: 100,
};

const buildWrapper = (props = {}) =>
Expand Down