2019-04-05 02:23:40 +07:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
|
2019-06-20 19:37:28 +07:00
|
|
|
import Spinner from './Spinner';
|
2019-10-17 16:52:11 +07:00
|
|
|
import { Circular, Wrapper } from './styles';
|
2019-04-05 02:23:40 +07:00
|
|
|
|
2019-06-20 19:37:28 +07:00
|
|
|
describe('<Spinner /> component', () => {
|
2019-04-05 02:23:40 +07:00
|
|
|
test('should render the component in default state', () => {
|
2019-06-20 19:37:28 +07:00
|
|
|
const wrapper = shallow(<Spinner />);
|
2019-10-17 16:52:11 +07:00
|
|
|
const wrapperComponent = wrapper.find(Wrapper);
|
|
|
|
const circular = wrapper.find(Circular);
|
|
|
|
|
|
|
|
expect(circular.props().size).toBe(50);
|
|
|
|
expect(wrapperComponent.props().centered).toBe(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('should render the component in custom state', () => {
|
|
|
|
const wrapper = shallow(<Spinner centered={true} size={10} />);
|
|
|
|
const wrapperComponent = wrapper.find(Wrapper);
|
|
|
|
const circular = wrapper.find(Circular);
|
|
|
|
|
|
|
|
expect(circular.props().size).toBe(10);
|
|
|
|
expect(wrapperComponent.props().centered).toBe(true);
|
|
|
|
|
2019-04-05 02:23:40 +07:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|