nexxtway/react-rainbow

View on GitHub
src/components/RenderIf/__test__/renderIf.spec.js

Summary

Maintainability
A
3 hrs
Test Coverage
import React from 'react';
import { mount } from 'enzyme';
import RenderIf from '..';

describe('<RenderIf/>', () => {
    it('should not render the children when isTrue is false', () => {
        const component = mount(
            <RenderIf>
                <svg />
            </RenderIf>,
        );
        expect(component.find('svg').exists()).toBe(false);
    });
    it('should render the children when isTrue is true', () => {
        const component = mount(
            <RenderIf isTrue>
                <svg />
            </RenderIf>,
        );
        expect(component.find('svg').exists()).toBe(true);
    });
});