mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import { PluginListPage, Props } from './PluginListPage';
|
|
import { NavModel, Plugin } from '../../types';
|
|
import { LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
navModel: {
|
|
main: {
|
|
text: 'Configuration',
|
|
},
|
|
node: {
|
|
text: 'Plugins',
|
|
},
|
|
} as NavModel,
|
|
plugins: [] as Plugin[],
|
|
searchQuery: '',
|
|
setPluginsSearchQuery: jest.fn(),
|
|
setPluginsLayoutMode: jest.fn(),
|
|
layoutMode: LayoutModes.Grid,
|
|
loadPlugins: jest.fn(),
|
|
hasFetched: false,
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
return shallow(<PluginListPage {...props} />);
|
|
};
|
|
|
|
describe('Render', () => {
|
|
it('should render component', () => {
|
|
const wrapper = setup();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render list', () => {
|
|
const wrapper = setup({
|
|
hasFetched: true,
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|