Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erezLieberman/fec54d616915d7c7e58c9bde4fa20eec to your computer and use it in GitHub Desktop.
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 NameOfComponent from '../src/NameOfComponent';
describe('NameOfComponent Basic: ', () => {
it('should verified that component is exits', () => {
const wrapper = mount(
<NameOfComponent />
);
expect(wrapper).toHaveLength(1);
});
it('should verified that method name component works as as expected', () => {
const wrapper = mount(shallow(<NameOfComponent propsname={200} />).get(0));
expect(wrapper.instance().methodName()).toEqual(someValue);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment