mirror of
https://github.com/apache/superset.git
synced 2026-04-26 11:34:27 +00:00
[superset-client] replace misc ajax calls (#6135)
* [superset-client][misc] replace ajax calls in DashboardTable, TableLoader, utils, common * [superset-client][misc] replace ajax calls in AsyncSelect, HeaderActions, Deck.gl * [superset-client][misc] fix tests * [superset-client] remove unneeded functional setState calls * [superset-client] make welcome a redux app for toasts * [superset-client] make Profile a redux app for toasts * [superset-client] TableLoader don't pass toast props to dom nodes * tweak deckgl Multi syntax
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Col, Row, Tab } from 'react-bootstrap';
|
||||
import { mount } from 'enzyme';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { user } from './fixtures';
|
||||
import App from '../../../src/profile/components/App';
|
||||
@@ -14,13 +14,15 @@ describe('App', () => {
|
||||
React.isValidElement(<App {...mockedProps} />),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('renders 2 Col', () => {
|
||||
const wrapper = mount(<App {...mockedProps} />);
|
||||
const wrapper = shallow(<App {...mockedProps} />);
|
||||
expect(wrapper.find(Row)).toHaveLength(1);
|
||||
expect(wrapper.find(Col)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('renders 4 Tabs', () => {
|
||||
const wrapper = mount(<App {...mockedProps} />);
|
||||
const wrapper = shallow(<App {...mockedProps} />);
|
||||
expect(wrapper.find(Tab)).toHaveLength(4);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { shallow } from 'enzyme';
|
||||
import thunk from 'redux-thunk';
|
||||
import configureStore from 'redux-mock-store';
|
||||
|
||||
import { user } from './fixtures';
|
||||
import CreatedContent from '../../../src/profile/components/CreatedContent';
|
||||
import TableLoader from '../../../src/components/TableLoader';
|
||||
|
||||
// store needed for withToasts(TableLoader)
|
||||
const mockStore = configureStore([thunk]);
|
||||
const store = mockStore({});
|
||||
|
||||
describe('CreatedContent', () => {
|
||||
const mockedProps = {
|
||||
user,
|
||||
};
|
||||
it('is valid', () => {
|
||||
expect(
|
||||
React.isValidElement(<CreatedContent {...mockedProps} />),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('renders 2 TableLoader', () => {
|
||||
const wrapper = mount(<CreatedContent {...mockedProps} />);
|
||||
const wrapper = shallow(<CreatedContent {...mockedProps} />, { context: { store } });
|
||||
expect(wrapper.find(TableLoader)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('renders 2 titles', () => {
|
||||
const wrapper = mount(<CreatedContent {...mockedProps} />);
|
||||
const wrapper = shallow(<CreatedContent {...mockedProps} />, { context: { store } });
|
||||
expect(wrapper.find('h3')).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { shallow } from 'enzyme';
|
||||
import thunk from 'redux-thunk';
|
||||
import configureStore from 'redux-mock-store';
|
||||
|
||||
import { user } from './fixtures';
|
||||
import Favorites from '../../../src/profile/components/Favorites';
|
||||
import TableLoader from '../../../src/components/TableLoader';
|
||||
|
||||
// store needed for withToasts(TableLoader)
|
||||
const mockStore = configureStore([thunk]);
|
||||
const store = mockStore({});
|
||||
|
||||
describe('Favorites', () => {
|
||||
const mockedProps = {
|
||||
user,
|
||||
};
|
||||
it('is valid', () => {
|
||||
expect(
|
||||
React.isValidElement(<Favorites {...mockedProps} />),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('renders 2 TableLoader', () => {
|
||||
const wrapper = mount(<Favorites {...mockedProps} />);
|
||||
const wrapper = shallow(<Favorites {...mockedProps} />, { context: { store } });
|
||||
expect(wrapper.find(TableLoader)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('renders 2 titles', () => {
|
||||
const wrapper = mount(<Favorites {...mockedProps} />);
|
||||
const wrapper = shallow(<Favorites {...mockedProps} />, { context: { store } });
|
||||
expect(wrapper.find('h3')).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { user } from './fixtures';
|
||||
import RecentActivity from '../../../src/profile/components/RecentActivity';
|
||||
import TableLoader from '../../../src/components/TableLoader';
|
||||
|
||||
|
||||
describe('RecentActivity', () => {
|
||||
const mockedProps = {
|
||||
user,
|
||||
@@ -15,8 +14,9 @@ describe('RecentActivity', () => {
|
||||
React.isValidElement(<RecentActivity {...mockedProps} />),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('renders a TableLoader', () => {
|
||||
const wrapper = mount(<RecentActivity {...mockedProps} />);
|
||||
const wrapper = shallow(<RecentActivity {...mockedProps} />);
|
||||
expect(wrapper.find(TableLoader)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user