Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 2.25 KB

README.md

File metadata and controls

64 lines (47 loc) · 2.25 KB

Jest + Enzime vs Mocha + chaiJquery

  • version with Mocha + chaiJquery

  • version with Jest + Enzime

    • /src/__tests__
    • created by Facebook (Jest) and Airbnb (Enzime)
    • default on Create React App

Useful links

Sample code

    beforeEach(() => {
        component = renderComponent(WelcomePage);
    });

    it('renders text ', () => {
        expect(component).to.contain('Example list of languages');
    });
    
    it('when submitted, clears the input', () => {
        component.simulate('submit');
        expect(component.find('input:text')).to.have.value('');
    });
    beforeEach(() => {
        component = mountWithRedux(<WelcomePage />);
    });

    it('renders text ', () => {
        expect(component.text()).toContain('Example list of languages');
    });
    
    it('when submitted, clears the input', () => {
        component.simulate('submit');
        // Enzime does not have pseudo-class CSS selector yet
        // So we cant use input:text
        expect(component.find('input').prop('value')).toBe('');
    });

Created with Create React App

This project was bootstrapped with Create React App.

Below you will find some information on how to perform common tasks.
You can find the most recent version of this guide here.