Skip to content

Instantly share code, notes, and snippets.

@ollelauribostrom
Last active June 6, 2018 08:13
Show Gist options
  • Save ollelauribostrom/938a755cb3407b79918e8a53262d053b to your computer and use it in GitHub Desktop.
Save ollelauribostrom/938a755cb3407b79918e8a53262d053b to your computer and use it in GitHub Desktop.
import * as React from 'react';
import { shallow } from 'enzyme';
import { Box } from './Box';
describe('Tests for Box component', () => {
it('should render', () => {
const box = shallow(<Box />);
expect(box.find('.box').exists()).toEqual(true);
});
it('should apply custom class name if provided', () => {
const box = shallow(<Box customClassName='custom-red-box' />);
expect(box.hasClass('custom-red-box')).toEqual(true);
});
it('should apply label if provided', () => {
const box = shallow(<Box label='Red' />);
expect(box.text()).toEqual('Red');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment