mirror of
https://github.com/apache/superset.git
synced 2026-04-09 19:35:21 +00:00
* [toasts] get rid of notify globals, refactor messageToasts for use by entire app * [remove notify] use arrow func in ajax call * fix lint + tests * actually fix tests from messageToast refactor * add 'test:one' npm script * debugger * [toasts] convert bootstrap flash messages to toasts in explore + sqllab * [toasts][tests] import from right file
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import configureStore from 'redux-mock-store';
|
|
import { expect } from 'chai';
|
|
import { describe, it } from 'mocha';
|
|
import { shallow } from 'enzyme';
|
|
|
|
import MetricDefinitionOption from '../../../../src/explore/components/MetricDefinitionOption';
|
|
import MetricOption from '../../../../src/components/MetricOption';
|
|
import ColumnOption from '../../../../src/components/ColumnOption';
|
|
import AggregateOption from '../../../../src/explore/components/AggregateOption';
|
|
|
|
describe('MetricDefinitionOption', () => {
|
|
const mockStore = configureStore([]);
|
|
const store = mockStore({});
|
|
|
|
function setup(props) {
|
|
return shallow(<MetricDefinitionOption {...props} />, { context: { store } }).dive();
|
|
}
|
|
|
|
it('renders a MetricOption given a saved metric', () => {
|
|
const wrapper = setup({ option: { metric_name: 'a_saved_metric' } });
|
|
expect(wrapper.find(MetricOption)).to.have.lengthOf(1);
|
|
});
|
|
|
|
it('renders a ColumnOption given a column', () => {
|
|
const wrapper = setup({ option: { column_name: 'a_column' } });
|
|
expect(wrapper.find(ColumnOption)).to.have.lengthOf(1);
|
|
});
|
|
|
|
it('renders an AggregateOption given an aggregate metric', () => {
|
|
const wrapper = setup({ option: { aggregate_name: 'an_aggregate' } });
|
|
expect(wrapper.find(AggregateOption)).to.have.lengthOf(1);
|
|
});
|
|
});
|