Skip to content

Instantly share code, notes, and snippets.

@ollelauribostrom
Last active June 6, 2018 08:14
Show Gist options
  • Save ollelauribostrom/7f59661df670ec9fde8d110d924a2a1a to your computer and use it in GitHub Desktop.
Save ollelauribostrom/7f59661df670ec9fde8d110d924a2a1a 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')).toExist();
});
it('should apply custom class name if provided', () => {
const box = shallow(<Box customClassName='custom-red-box' />);
expect(box).toHaveClassName('custom-red-box');
});
it('should apply label if provided', () => {
const box = shallow(<Box label='Red' />);
expect(box).toHaveText('Red');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment