Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created September 16, 2018 11:27
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 productioncoder/b8871700c45276a6553237d259a2fe4a to your computer and use it in GitHub Desktop.
Save productioncoder/b8871700c45276a6553237d259a2fe4a to your computer and use it in GitHub Desktop.
Testing Youtube AppLayout component
import React from 'react';
import {shallow} from 'enzyme';
import {AppLayout} from '../AppLayout';
test('renders empty <AppLayout/>', () => {
const wrapper = shallow(
<AppLayout/>
);
expect(wrapper).toMatchSnapshot();
});
test('renders <AppLayout/> with one child', () => {
const wrapper = shallow(
<AppLayout>
<div>Child 1</div>
</AppLayout>
);
expect(wrapper).toMatchSnapshot();
});
test('renders <AppLayout/> with children', () => {
const wrapper = shallow(
<AppLayout>
<div>Child</div>
<div>
<span>Child</span>
<p>Child</p>
</div>
</AppLayout>
);
expect(wrapper).toMatchSnapshot();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment