ButtonRow.test.tsx 650 B

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import ButtonRow, { Props } from './ButtonRow';
  4. const setup = (propOverrides?: object) => {
  5. const props: Props = {
  6. isReadOnly: true,
  7. onSubmit: jest.fn(),
  8. onDelete: jest.fn(),
  9. };
  10. Object.assign(props, propOverrides);
  11. return shallow(<ButtonRow {...props} />);
  12. };
  13. describe('Render', () => {
  14. it('should render component', () => {
  15. const wrapper = setup();
  16. expect(wrapper).toMatchSnapshot();
  17. });
  18. it('should render with buttons enabled', () => {
  19. const wrapper = setup({
  20. isReadOnly: false,
  21. });
  22. expect(wrapper).toMatchSnapshot();
  23. });
  24. });