Skip to content

Commit f7458ce

Browse files
Anisha1234portante
authored andcommitted
Adds snapshot test for Table and Button component
1 parent e726277 commit f7458ce

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import { shallow } from 'enzyme';
3+
import Button from './index';
4+
5+
const mockProps = {
6+
name: 'mockButton',
7+
type: 'primary',
8+
disabled: false,
9+
onClick: jest.fn(),
10+
};
11+
12+
const mockDispatch = jest.fn();
13+
const wrapper = shallow(<Button dispatch={mockDispatch} {...mockProps} />);
14+
15+
describe('test rendering of Button component', () => {
16+
it('render with empty props', () => {
17+
expect(wrapper).toMatchSnapshot();
18+
});
19+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import { shallow } from 'enzyme';
3+
import Table from './index';
4+
5+
const mockProps = {
6+
dataSource: [],
7+
columns: [{ title: 'Controller', dataIndex: 'controller', key: 'ctrl' }],
8+
loading: true,
9+
};
10+
11+
const mockDispatch = jest.fn();
12+
const wrapper = shallow(<Table dispatch={mockDispatch} {...mockProps} />);
13+
14+
describe('test rendering of Table component', () => {
15+
it('render with empty props', () => {
16+
expect(wrapper).toMatchSnapshot();
17+
});
18+
});

0 commit comments

Comments
 (0)