Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created September 15, 2018 19:20
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/0fb09562b1d5678185419b6f5c66bfd0 to your computer and use it in GitHub Desktop.
Save productioncoder/0fb09562b1d5678185419b6f5c66bfd0 to your computer and use it in GitHub Desktop.
Tests for VideoGrid and VideoGridHeader
import React from 'react';
import {shallow} from 'enzyme';
import {VideoGrid} from '../VideoGrid';
describe('VideoGrid', () => {
test('renders without props', () => {
const wrapper = shallow(<VideoGrid/>);
expect(wrapper).toMatchSnapshot();
});
test('renders with title prop', () => {
const wrapper = shallow(<VideoGrid title='Trending'/>);
expect(wrapper).toMatchSnapshot();
});
test('renders without divider', () => {
const wrapper = shallow(<VideoGrid hideDivider={true}/>);
expect(wrapper).toMatchSnapshot();
});
});
import React from 'react';
import {shallow} from 'enzyme';
import {VideoGridHeader} from '../VideoGridHeader';
describe('VideoGridHeader', () => {
test('renders without props', () => {
const wrapper = shallow(<VideoGridHeader/>);
expect(wrapper).toMatchSnapshot();
});
test('renders with empty string header', () => {
const wrapper = shallow(<VideoGridHeader title=''/>);
expect(wrapper).toMatchSnapshot();
});
test('renders with title', () => {
const wrapper = shallow(<VideoGridHeader title='Autos & Vehicles'/>);
expect(wrapper).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment