import { configure, mount, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import * as React from 'react'; import renderer from 'react-test-renderer'; import MDDoughnut from '../index'; configure({ adapter: new Adapter() }); beforeEach(() => { jest.useFakeTimers(); }); it('renders correctly with defaults', () => { const component = renderer .create() .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with not animation1', () => { const component = renderer .create( ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with animation2', () => { const component = renderer .create( ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with animation3', () => { const component = renderer .create( ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with animation4', () => { const component = renderer .create( ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with animation', () => { const component = shallow( ); component.setProps({ size: 100, autoStart: false }); component.setProps({ size: 100, autoStart: true }); jest.runOnlyPendingTimers(); jest.advanceTimersByTime(1000); const b: any[] = component.state('arcProportAnimatedValues'); expect(b.length).toEqual(6); jest.useRealTimers(); });