Skip to content

Instantly share code, notes, and snippets.

@iamalvisng
Last active May 16, 2018 05:46
Show Gist options
  • Save iamalvisng/dac836d6d01b4d4d8a08a870f0637f54 to your computer and use it in GitHub Desktop.
Save iamalvisng/dac836d6d01b4d4d8a08a870f0637f54 to your computer and use it in GitHub Desktop.
import React from 'react';
import { string, bool, func } from 'prop-types';
import { StyledButton } from './styled';
const Button = ({
size,
text,
}) => (
<StyledButton
size={size}
text={text}
>
{text}
</StyledButton>
);
EXPButton.propTypes = {
size: string,
text: string,
};
EXPButton.defaultProps = {
size: '',
text: '',
};
export default Button;
import React from 'react';
import { shallow } from 'enzyme';
import Button from '../../components/Button/Button';
describe('Component: Button', () => {
const minProps = {
text: '',
size: '',
};
it('renders a button in size of "small" with text in it', () => {
const wrapper = shallow(
<Button {...minProps} size="small" text="Join us" />
);
expect(wrapper.prop('size')).toBe('small');
expect(wrapper.prop('text')).toBe('Join us');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment