mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
first test
This commit is contained in:
parent
0b7576a1f9
commit
64eace96c0
31
public/app/features/plugins/PluginListPage.test.tsx
Normal file
31
public/app/features/plugins/PluginListPage.test.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { PluginListPage, Props } from './PluginListPage';
|
||||
import { NavModel, Plugin } from '../../types';
|
||||
|
||||
const setup = (propOverrides?: object) => {
|
||||
const props: Props = {
|
||||
navModel: {} as NavModel,
|
||||
plugins: [] as Plugin[],
|
||||
layoutMode: 'grid',
|
||||
loadPlugins: jest.fn(),
|
||||
};
|
||||
|
||||
Object.assign(props, propOverrides);
|
||||
|
||||
const wrapper = shallow(<PluginListPage {...props} />);
|
||||
const instance = wrapper.instance() as PluginListPage;
|
||||
|
||||
return {
|
||||
wrapper,
|
||||
instance,
|
||||
};
|
||||
};
|
||||
|
||||
describe('Render', () => {
|
||||
it('should render component', () => {
|
||||
const { wrapper } = setup();
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
@ -9,7 +9,7 @@ import { loadPlugins } from './state/actions';
|
||||
import { getNavModel } from '../../core/selectors/navModel';
|
||||
import { getLayoutMode, getPlugins } from './state/selectors';
|
||||
|
||||
interface Props {
|
||||
export interface Props {
|
||||
navModel: NavModel;
|
||||
plugins: Plugin[];
|
||||
layoutMode: string;
|
||||
|
@ -0,0 +1,21 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Render should render component 1`] = `
|
||||
<div>
|
||||
<PageHeader
|
||||
model={Object {}}
|
||||
/>
|
||||
<div
|
||||
className="page-container page-body"
|
||||
>
|
||||
<Connect(PluginActionBar)
|
||||
onQueryChange={[Function]}
|
||||
searchQuery=""
|
||||
/>
|
||||
<PluginList
|
||||
layout="grid"
|
||||
plugins={Array []}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
Loading…
Reference in New Issue
Block a user