mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 09:05:45 -06:00
* created react component and moved markdown * extracting components * Broke out parts into components * tests * Flattened file structure * Tests * made instances typed in test * typing * function instead of variable * updated user model with missing properties * added full set of properties to user mock * redone from variable to function * refactor: minor refactorings of #13091 * removed logging
42 lines
861 B
TypeScript
42 lines
861 B
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import TopSection from './TopSection';
|
|
|
|
jest.mock('../../config', () => ({
|
|
bootData: {
|
|
navTree: [
|
|
{ id: '1', hideFromMenu: true },
|
|
{ id: '2', hideFromMenu: true },
|
|
{ id: '3', hideFromMenu: false },
|
|
{ id: '4', hideFromMenu: true },
|
|
],
|
|
},
|
|
}));
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props = Object.assign(
|
|
{
|
|
mainLinks: [],
|
|
},
|
|
propOverrides
|
|
);
|
|
|
|
return shallow(<TopSection {...props} />);
|
|
};
|
|
|
|
describe('Render', () => {
|
|
it('should render component', () => {
|
|
const wrapper = setup();
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render items', () => {
|
|
const wrapper = setup({
|
|
mainLinks: [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }],
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|