Files
grafana/public/app/features/plugins/PluginListPage.test.tsx

39 lines
947 B
TypeScript
Raw Normal View History

2018-09-25 16:50:13 +02:00
import React from 'react';
import { shallow } from 'enzyme';
import { PluginListPage, Props } from './PluginListPage';
2018-09-27 14:45:36 +02:00
import { NavModel, Plugin } from '../../types';
2018-09-27 14:19:36 +02:00
import { LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
2018-09-25 16:50:13 +02:00
const setup = (propOverrides?: object) => {
const props: Props = {
navModel: {} as NavModel,
2018-09-27 14:45:36 +02:00
plugins: [] as Plugin[],
2018-10-03 09:43:10 +02:00
searchQuery: '',
setPluginsSearchQuery: jest.fn(),
setPluginsLayoutMode: jest.fn(),
2018-09-27 14:19:36 +02:00
layoutMode: LayoutModes.Grid,
2018-09-25 16:50:13 +02:00
loadPlugins: jest.fn(),
2018-10-11 11:49:34 +02:00
hasFetched: false,
2018-09-25 16:50:13 +02:00
};
Object.assign(props, propOverrides);
2018-10-11 11:49:34 +02:00
return shallow(<PluginListPage {...props} />);
2018-09-25 16:50:13 +02:00
};
describe('Render', () => {
it('should render component', () => {
2018-10-11 11:49:34 +02:00
const wrapper = setup();
expect(wrapper).toMatchSnapshot();
});
it('should render list', () => {
const wrapper = setup({
hasFetched: true,
});
2018-09-25 16:50:13 +02:00
expect(wrapper).toMatchSnapshot();
});
});