Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save erezLieberman/fec54d616915d7c7e58c9bde4fa20eec to your computer and use it in GitHub Desktop.

Select an option

Save erezLieberman/fec54d616915d7c7e58c9bde4fa20eec to your computer and use it in GitHub Desktop.
Basic for test component method in react + jest + enzyme because our decorator
import React from 'react';
import _ from 'lodash';
import { mount, shallow } from 'enzyme';
import ProgressBar from '../src/ProgressBar';
describe('ProgressBar Basic: ', () => {
it('should verified that component is exits', () => {
const wrapper = mount(
<ProgressBar />
);
expect(wrapper).toHaveLength(1);
});
it('should verified that getWidth component works as as expected', () => {
const wrapper = mount(shallow(<ProgressBar total={200} value={15} />).get(0));
wrapper.setState({ noWidth:false });
expect(wrapper.instance().getWidth()).toEqual(7.5);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment