TopSection.test.tsx 861 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import TopSection from './TopSection';
  4. jest.mock('../../config', () => ({
  5. bootData: {
  6. navTree: [
  7. { id: '1', hideFromMenu: true },
  8. { id: '2', hideFromMenu: true },
  9. { id: '3', hideFromMenu: false },
  10. { id: '4', hideFromMenu: true },
  11. ],
  12. },
  13. }));
  14. const setup = (propOverrides?: object) => {
  15. const props = Object.assign(
  16. {
  17. mainLinks: [],
  18. },
  19. propOverrides
  20. );
  21. return shallow(<TopSection {...props} />);
  22. };
  23. describe('Render', () => {
  24. it('should render component', () => {
  25. const wrapper = setup();
  26. expect(wrapper).toMatchSnapshot();
  27. });
  28. it('should render items', () => {
  29. const wrapper = setup({
  30. mainLinks: [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }],
  31. });
  32. expect(wrapper).toMatchSnapshot();
  33. });
  34. });